On 25.03.2010, at 21:23, Stefan Marr wrote:
> Hi:
>
>
> On 24 Mar 2010, at 17:58, Jonathan Bond-Caron wrote:
>> One thing I feel is missing from the RFC is how is_a() and instanceof are
>> affected with traits or grafts.
> Well, my personal (I admit very academic) position is:
> - Traits are not classes
> - Traits are not interfaces
> - Traits are not types
> - Traits cannot be instantiated
>
> Thus, there is no meaning of a is_a and instanceof, and it would not provide any meaningful
> information since you can exclude methods from a Trait in a composition.
>
> Thus, you should resort to interfaces for use-case where you need to ensure that an object
> provides a certain set of methods.
>
> Traits are purely for behavior, the class hierarchy or interface should provide the
> type-information/relations.
>
>
>> It's seem to me that a defining a 'trait' should be advertised strictly as
>> an 'advanced multiple inheritance technique' to reuse pieces of code and it
>> shouldn't be considered as an object (grafts proposal).
> It is not an object, right. You can not instantiate traits.
> But, I would not speak of multiple inheritance. I would prefer something along the lines of
> 'sustainable copy'n'past reuse'.
I think Stefan used the right metaphor in the RFC: its language level copy paste.
regards,
Lukas Kahwe Smith
mls@pooteeweet.org