Stevan Little skribis 2006-01-19 16:59 (-0500):
> But we cannot automagically inject a role into a class, for a number  
> of reasons.
> 1) thats just plain evil

But then, so is bless, so the two can play along.

> 2) what if the role conflicts with other roles being does-ed by Foo?  
> Debugging hell there.

Very good point.

> 3) What if Foo wants to have a .keys, .value, .exists, etc? Do they  
> shadow the Hash version? What if Foo.keys is implemented using  
> Hash.keys? Many issues abound here.

Even better point.

> >Sure, in Perl 5, you could have different kinds of references as
> >instances of the same class. But I don't recall ever having  
> >encountered
> >that.
> bless([] => 'Foo');
> bless({} => 'Foo');
> bless(\*Foo => 'Foo');
> bless(\(my $var) => 'Foo');

Okay, now I did encounter it...


Juerd
-- 
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html 
http://convolution.nl/gajigu_juerd_n.html

Reply via email to