Traits approaching mainstream Squeak

Daniel Vainsencher daniel.vainsencher at gmail.com
Fri Aug 26 09:18:49 UTC 2005


Hi everyone.

Traits are one of the things we hope to have in Squeak 3.9. They are a 
significant change to the language. On the bright side, it makes some 
things that were impossible to write without duplication possible, and 
many things that were hard to factor, easy.

On the other hand, its a change to Smalltalk the language, and thus has 
significant effects on the tools and the core (Kernel) libraries. Quite 
a few people have worked on Traits at some point or the other, and I'm 
happy to say its nearing being ready for mainstream use, and we'd like 
to start getting some concrete "think of this as your near term future 
squeak" feedback.

About the demo image - in its most recent incarnation, Traits is managed 
using packages, and its integration plan goes through the new process 
like any other change, as a set of package version loads. However since 
after loading, classes are implemented using Traits, the loading 
includes some self administered brain surgery, and thus is somewhat 
tricky. We haven't quite made it ready for clean loading yet, so what we 
provide at the moment is a demo image based on the final 3.8, which is 
at: http://www.cs.pdx.edu/~danielv/TraitsBeta3.02.tgz

There's quite a bit of conceptual & design documentation on Traits in 
the form of research papers. For that see 
http://www.iam.unibe.ch/~scg/Research/Traits/

Assuming you know what traits are, what the image contains is:
1. An implementation of Traits.
2. Traits are quite a bit like classes, so this duplication is removed 
using, you guessed it, Traits. So this is one huge example.
3. A few smaller simple examples.
4. Tests for lots of aspects.
5. A recent OB, with a couple of Browsers demonstrating support for 
Traits, in the direction that the papers mention.

Basically, the main conceptual "gotcha" you need to remember whenever 
working in a Traits image, is that if you're modifying code in a class, 
this code might actually come from a Trait, and thus you might actually 
want to change it there instead. If you don't know this (for example 
because the tool hasn't been updated yet, and doesn't show you the 
method comes from a trait, and you don't check yourself), then you'll 
duplicate the code when you modify it.

Note that we're extending the OB to support these things (we're not done 
yet), but there are many tools that need to be updated to be Traits 
aware - the debugger, the RB (this is an interesting job, since it would 
need to be aware of them!), alternative browsers and so forth. You're 
welcome to help in specifying and implementing the changes needed...

So, have fun, and try to give any significant feedbacks as early as 
possible.

Daniel Vainsencher



More information about the Squeak-dev mailing list