--- Audrey Tang <[EMAIL PROTECTED]> wrote:

> > I always thought when a role is applied to a class at runtime you
> > get a new (anonymous) subclass. The original class isn't affected.
> 
> Right, that's what usually happens with:
> 
>      my Dog $fido .= new;
>      $fido does Catlike;

Am I missing something here?  That's applying a role to an instance of
a class, not the class itself, and thus *should* create a new anonymous
class.
 
> To forcefully add a role to a class at a distance during runtime, use
 
> a class object call (see Moose::Meta::Class for more about these
> APIs):
> 
>      ^Dog.add_role(^Catlike);

That's more of what I was thinking, but where is this documented?  I
can't find it in http://dev.perl.org/perl6/doc/design/syn/S12.html.  I
see it in the Moose docs, but is this in Perl 6?  I thought it was.

Cheers,
Ovid

--

Buy the book -- http://www.oreilly.com/catalog/perlhks/
Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/

Reply via email to