Hi all,

In doing a bit of work with traits (roles) in Perl 5
(http://perlmonks.org/?node_id=577477), I've realized some edge cases
which could be problematic.

First, when a role is applied to a class at runtime, a instance of that
class in another scope may specifically *not* want that role.  Is there
a way of restricting a role to a particular lexical scope short of
merely applying that role to instances instead of classes?

Second, how can I remove roles from classes?  I've create some code
which adds an "is_selected" method to some classes but when I'm done,
I'd like top easily remove that role.  How do I do that?  Seems closely
related to my first question, but it's still a distinct issue, I think.

Third, http://dev.perl.org/perl6/doc/design/syn/S12.html says:

  You can also mixin a precomposed set of roles:

    $fido does Sentry | Tricks | TailChasing | Scratch;

Should that be the following?

    $fido does Sentry & Tricks & TailChasing & Scratch;



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

Reply via email to