[Grace-core] Traits as non-objects
Kim Bruce
kim at cs.pomona.edu
Mon Mar 18 14:37:22 PDT 2013
Andrew,
I'm a little confused by the example at the end of the paper. Can't I define (using your syntax):
def CatTrait(m) = trait {method name(m){...} method speak{ ....}}
myCat = object {inherits CatTrait("kitty")}
That syntax is a bit noisy (I'd rather drop the "inherits"), but otherwise seems to do what we want emulating classes and constructors.
One thing that jumps out here is that our original syntax:
class aCat.named(m) {...}
was pretty artificial. The aCat.named id was chosen to look like a regular method request, but there wasn't really anything to it except syntax.
Kim
On Mar 17, 2013, at 9:56 PM, Andrew P. Black <black at cs.pdx.edu> wrote:
> <NonObject Traits.pdf>
>
> I promised to write up a description of (my interpretation of) the trait inheritance proposal from Denver. Here it is. The file is in NewOOL/GracePaper/Traits/NonObject Traits
>
> Andrew
>
> _______________________________________________
> 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