Darren Duncan wrote:
> Jon Lang wrote:
>> Here, we need a bit of a clarification: are we talking roles or
>> classes?  Real example: Numeric is a role; Num is a class.  Both can
>> be used in signatures; but only classes can be used to create objects.
>>  That is, "my Num $x;" works; but "my Numeric $x;" doesn't.  As such,
>> you cannot coerce an object to a role; you can only coerce it to a
>> class that does that role.
> Bad example.  Both of those would work.  Otherwise one of the main reasons
> for roles to exist, which is to be able to declare a container $x and say
> that it may hold anything that does role Y, wouldn't be possible.  Perhaps a
> better example is "Num.new(...)" works but "Numeric.new(...)" doesn't. --

You are, of course, correct.  I think that what I meant to say was "my
$x is Num" vs. "my $x is Numeric".

Jonathan "Dataweaver" Lang

Reply via email to