Stateful traits

Alexandre Bergel Alexandre.Bergel at cs.tcd.ie
Thu Sep 28 12:30:13 UTC 2006


Hi Balázs

> The presentation has a slide titled Traits limits:
> 1) Trait users should define missing traits state
> 2) Important required methods and required state are mixed
> 3) Boilerplate glue code
> 4) Propagation of required accessors

With stateful traits:
1) a trait user (i.e., another trait or a class) does not need to  
define the state required by the used trait.
2) if a trait needs some variables, then it can define it. Whereas  
with stateless traits the needed state had to be specified as  
required methods.
3) less glue code is needed
4) state and accessors are not duplicated across users of a trait.

A working version of our paper should be available on the esug  
website I think.


> With stateful traits instead of 1) and 3) now they have to call the
> proper initialization methods, or setters of the traits. Is this  
> any better?

cf above. Else have a look at what we wrote :-)

> 2) is bad. Maybe categorisation of methods can help?
> 1) and 3) maybe also can be solved by tools, generating the proper
> inst vars, and accessors.
> What do you think?
>
> Another question: Can Traits define class side behaviour?

yes.

Cheers,
Alexandre

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.cs.tcd.ie/Alexandre.Bergel
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






More information about the Squeak-dev mailing list