On Jan 19, 2006, at 5:19 PM, Jonathan Scott Duff wrote:
On Thu, Jan 19, 2006 at 11:07:49PM +0100, Juerd wrote:
Stevan Little skribis 2006-01-19 16:59 (-0500):
2) what if the role conflicts with other roles being does-ed by Foo?
Debugging hell there.
Very good point.
Aren't role conflicts resolved at composition time (possibly by
failure)? That doesn't sound like debugging hell to me, but rather
clear indication of a problem and the location of that problem.
Role conflicts are resolved when a role (or set of roles) is composed
into a class. In this case the (automatically generated) code would
look something like this:
method new ($class: %params) {
my $self = $class.bless(%params);
$self does Hash;
return $self;
}
Or it would have to detect it in the class definition itself, in
which case it would add a does Hash; to the class def somewhere.
The reason this would be debugging hell (IMO at least) is that *I*
never told it to does Hash, so as far as I knew there was no clashes
in the roles I composed. Sure if was educated in the finer points of
Perl 6 I would know what happened, but a random newbie would be half-
way to PHP by now.
Stevan