NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Class::Role (Score:2)
Re:Class::Role (Score:2)
Note that in the following that I do not use the word "role" even though that's the Perl 6 term. This is deliberate to make it clear I'm only talking about Perl 5 traits. Even when I discuss Class::Role I'll call it a trait. Yes, I know that's awkward :)
Well, first and foremost, Class::Trait [cpan.org] is the only Perl module to have a substantially complete implementation of traits as described in the classic "traits paper [unibe.ch]" that introduced most programmers to traits.
As for Class::Role, it appears to have the s
Runtime role (trait) composition (Score:1)
Name::Of::Role->apply( $some_object_of_unknown_class );
Can (does/will) Class::Traits support that?
Re:Runtime role (trait) composition (Score:2)
It's possible that it will. For the time being, I'm doing some deep internals work with it to make sure that I have everything nailed down. After I feel truly comfortable with its current state I'll start expanding it.
Re:Runtime role (trait) composition (Score:1)
Re:Runtime role (trait) composition (Score:2)
Currently there is a workaround:
That will properly use those traits, report conflicts, etc. However, it only works once. If both of those traits have identically named methods, the initialize() will fail. The following will not work:
This is because by the time the second trait is used, the meta information for the firs
Re:Runtime role (trait) composition (Score:1)
eval sprintf "package %s; Class::Trait->apply(%s);",
ref $some_object_of_unknown_class, $trait_class;
whereas I'd like to be able to do:
$trait_class->apply( $some_object_of_unknown_class );
(which would rebless $some_object_of_unknown_class into a new clas
Re:Runtime role (trait) composition (Score:1)
I just wanted to add a thank you for working on this.
Reply to This
Parent