Traits in use (was Re: Re: Squeak and Namespaces)
Klaus D. Witzel
klaus.witzel at cobss.com
Fri Dec 1 21:16:08 UTC 2006
Hi Avi,
I do not believe that you haven't used the trait concept for real-world
problems (no offense).
Instead, whenever you factored some methods such that instance variables
and class variables are on accessors, you have traitified these methods.
Every other class, which provides the respective accessors, can (re-)use
these traitified methods (modulo that that makes sense for an application).
Stateless traits is nothing much more. But the Trait system in Squeak
comes with Trait *composition* and composition is something which perhaps
was not used before (perhaps not intentionally). Doing Trait composition
manually, without using the supportive code in Squeak, is like gcc -S
followed by cut&paste, IMHO ;-)
/Klaus
On Fri, 01 Dec 2006 20:05:38 +0100, Avi Bryant wrote:
> On 12/1/06, J J <azreal1977 at hotmail.com> wrote:
>
>> Yes, the inheritance model without them has some real problems. And
>> finding
>> a solution is tough. C++'s multiple inheritance? Too complicated.
>> Java's
>> interfaces? Too much work and code duplication. So now smalltalk has a
>> solution, and IMO the best one.
>
> Is that opinion based on real-world use of Traits? Now that they've
> been in the base image for a decent length of time, I'm curious to
> hear of any war stories from using Traits outside of a research
> context. I've never used them in anger myself, so it would be very
> interesting to hear from those who have.
>
> Avi
>
>
More information about the Squeak-dev
mailing list
|