On May 19, 2006, at 10:13 AM, P T Withington wrote:

> On 2006-05-19, at 11:28 EDT, Jim Grandy wrote:
>
>> On May 19, 2006, at 3:06 AM, P T Withington wrote:
>>
>>> Henry stumbled on a gray area in our traits implementation:  What  
>>> should happen if you try to instantiate a trait?  Should it be an  
>>> error, or should it default to creating an anonymous class with  
>>> Instance as the superclass?
>>
>> I think it should be an error. It doesn't make sense to  
>> instantiate a trait -- what would be the base class? (And don't  
>> say Object -- the point of Traits is that they don't inherit from  
>> anything.)
>
> The specific example is LzDataElement, which wants to be  
> instantiable, but also be able to be mixed in to LzDataset.  If it  
> is an error, we have to define LzDataElementTrait, which has all  
> the properties LzDataElement used to, and define LzDataElement as  
> having that as a trait.  I'm not campaigning one way or another,  
> but it makes for a little extra code on the programmer's part.

I think that's the right way to do it -- create an LzDataElementTrait  
and have LzDataElement trivially derive from it.
_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev

Reply via email to