Traits

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Traits

Andy Burnett
Thanks Matthew, that's interesting. I have never heard of traits.  So
'uses:' is a way of incorporating behaviour/values which don't naturally
inherit?

cheers
AB


This is not a class; it is a trait. Traits are separate from
classes.

Object is not special; neither is it's superclass ProtoObject.
ProtoObject, the root object is just a subclass of nil.

> 2. What does uses: mean?  I haven't seen this in a class definition
> before.

uses: can be added to any class or trait definition to signify
that this class/trait incorporates some traits into it's
behavior definition. The only senders I know of in a stock image
are ClassDescription and TraitDescription; traits are not used
much yet
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Traits

Tapple Gao
On Mon, Sep 03, 2007 at 06:42:15PM +0300, [hidden email] wrote:
> Thanks Matthew, that's interesting. I have never heard of traits.  So
> 'uses:' is a way of incorporating behaviour/values which don't naturally
> inherit?

Traits are a new (as of squeak 3.9) feature of squeak, and were
added by the Software Composition Group at Bern University.
Their traits page has a bit more information:

http://www.iam.unibe.ch/~scg/Research/Traits/index.html

Traits are similar to Ruby Mixins: basic behavior patterns can
be defined in a trait then inserted into classes that have that
behavior pattern.

--
Matthew Fulmer -- http://mtfulmer.wordpress.com/
Help improve Squeak Documentation: http://wiki.squeak.org/squeak/808
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners