Yes, that's a very good paper, which is why Perl 6 now has something
called Roles, which are intended to degenerate either to Traits or
Interfaces.  My take on it is that Roles' most important, er, role
will be to abstract out the decision to compose or delegate.  But we'd
like them to function as interfaces when the Role is "abstract",
and we'd like them to function as Traits when you don't happen to
specify any state attributes.  But for hiding the delegation decision,
you at least have to allow the amount of state that lets you remember
the object you're delegating to.  Of course, the Traits paper didn't
go into traits with state, though it did mention it as a future research
topic.  We're just doing that future research for them.  :-)

By the way, we distinguish Traits from traits (which are compile-time
properties applied by "is".  To apply a Role we use "does".

Larry

Reply via email to