[Grace-core] Traits as non-objects

Kim Bruce kim at cs.pomona.edu
Mon Mar 18 14:41:19 PDT 2013


I'm also worried about any attempt to use aliases.  I remember Eiffel running into all sorts of problems with this.  I'd rather declare a new object and use forwarding from the new names to a method request with the old on an instance variable of the old.  You might be able to define a language construct that works similarly, but the semantics is tricky, as I recall.

Kim

P.S.  If you explicitly do not allow the new object not to be a subtype of the type of the old you might avoid some of the problems.  Eiffel kept the subtyping and interpretations of the method requests varied depending on whether you were looking at an object as coming from the subclass or superclass.

On Mar 18, 2013, at 2:29 PM, Marco Servetto <marco.servetto at gmail.com> wrote:

>>> -I'm pretty sure Eiffel's rename (and I imagine Marco's work) "deeply" renames methods..
> In order to comment here, I readed yust the piece of the proposal
> about renaming.
> The "deep rename" is a non trivial issue.
> While a naive implementation simply rename in the cloned method from x
> to y the self.x into self.y,
> keeping the meaning of direct recursion,
> still have no way to fix indirect recursions.
> 
> In a world without nested classes (or when the trait operators does
> not works over methods over nested traits/classes)
> than you can rename all the self.x occurences and the method
> declaration, and obtaining a full rename, that does not preserve the
> old method.
> In a world with deep trait operator a nominal type system is required
> (or something that keep trace of where a method is born, like the
> first declaration of a method in a java interface) and the rename
> operator have to act of the original point of the method,; then the
> rename can be applied in a similar fascion w.r.t. the well known
> refactoring rename.
> _______________________________________________
> Grace-core mailing list
> Grace-core at cecs.pdx.edu
> https://mailhost.cecs.pdx.edu/mailman/listinfo/grace-core



More information about the Grace-core mailing list