[Grace-core] Fwd: [important] Traits

James Noble kjx at ecs.vuw.ac.nz
Mon Mar 11 22:14:27 PDT 2013


On 12/03/2013, at 17:58 PM, Marco Servetto wrote:

> A "factory" if I understand correctly (and I will not call it factory,
> since it get quite misleading)
> is simply a method/function that returns a trait, so that lexical
> scoping can do his job.

No - a factory is an object with a method (or just a method/function)
that returns a new object by instantiating a trait. At least that's how 
we've been talking about it. 

Off the top of my head, I don't know why a "first class" trait couldn't
simply implement its constructor method itself - making it a bit
more like our original class design, closer to a Smalltalk class,
so you wouldn't need to make factories that did nothing but called
the trait "new" method.  Presumably we can stop there and avoid
the temptation towards the whole static mess...

 he temptation is not to stop there and 
end up with the whole static mess
But that would remove the focus from the "object" constructors -
we would have trait/class constructors and object constructors,
basically like Java classes and anon-inner-classes.  Object
constructors would be shorthands for classes (not the other way around)

J




More information about the Grace-core mailing list