On Fri, Dec 12, 2003 at 07:12:40PM +0100, Stéphane Payrard wrote:
: > 
: > A role can also supply one or more attributes.
: > 
: > :         inheritance (and maybe some other stuff, too).  Used with C<does>.
: 
: The smalltalk paper you mentionned which talked about roles (under
: the name of traits) said that roles were stateless.

Though they did point out that state was one of the thing they
wanted to look into.

: What are the consequences of using stateful roles?

That's what we're trying to figure out.  :-)

It seems to me that as long as the attributes declared in the role are
elaborated into the "real" object at class composition time, there's
really very little problem with doing that part of it.  You have to
watch for collisions just as you do with method names, of course.
The tricky part comes later when you start to use it.  The trickiest
thing will be to know if some change in the rest of the object has
invalidated your role's state such that you have to recompute it.

: A related question. Will getter and setter methods will have the
: same name as the underlying accessed attributes?

Yes, the getter/setter method is the same name as the attribute.
(There's only one method, but it can be an lvalue method for rw
attributes).

Larry

Reply via email to