On Fri, Oct 28, 2005 at 06:23:28PM +0200, Yuval Kogman wrote:
> On Fri, Oct 28, 2005 at 10:38:31 -0500, Jonathan Scott Duff wrote:
> > Er, there is only one $:foo.  X doesn't have any private members, nor
> > does Y (because they're roles).  Only C has private members.  So,
> > modulo the multiple composition of Foo, I don't think there's a
> > conflict.
> 
> Really? I didn't know that... In that case roles are broken... They
> will need instance data (that doesn't conflict when it's private) to
> support the methods they give their consumers.
> 
> Is there any good reason to not allow roles to introduce member data
> into a class?

Roles can hold instance data that will be composed into a class.  What
I'm saying is that if you have two roles:

role X { has $:foo; }
role Y { has $:foo; }

And a class that's composed of them:

class Xy does X does Y { ... }

That there will not be two slots for $:foo in Xy, but only one.

But, I'm probably wrong about this as the X role may have methods that
use $:foo in one way and the Y role may have methods that use $:foo in
some other, incompatible way, so perhaps there will be a conflict just
as when there are 2 methods of the same name.

-Scott
-- 
Jonathan Scott Duff
[EMAIL PROTECTED]

Reply via email to