On Wed, Jul 13, 2005 at 05:33:18PM -0400, David Storrs wrote:
: I'd like to have it explained what Roles  
: offer that justifies their existence, since they won't be anything  
: but a restricted form of a class.

Please check your assumptions.

In addition to what chromatic said, I'd like to point out that you've
got the abstraction levels backwards by my lights: these days I
tend to think of the class as a restricted form of role.  A class is
restricted to having to provide a working interface to real objects.
A role doesn't have to do that--it's just a semantic slice of interface
and maybe some handy default behavior.  It's a bit of generic code
that doesn't have to make complete sense in isolation, as long as some
real class can make some sense of it when combined with other things.

Looking at it another way, roles are attempting to provide the
stable semantic currency that other languages try to provide with
final classes.  Because roles are composed rather than inherited,
they avoid many of the problems that final classes engender in such
languages.  Class finalization (as instigated by the class itself)
will someday be viewed as a tremendous botch, I think.

Larry

Reply via email to