Austin Hastings wrote:
role Dog {must bark();}
role Tree {must bark();}
class crossPerson {
method bark() {speak_sharply;}
}
class Trog does Tree does Dog {
method bark() {bark_like_a_trog;}
}
multi sub purchase(Dog $mansBestFriend) {...}
multi sub purchase(Tree
On Thu, 2004-01-08 at 16:24, Jonathan Lang wrote:
In this example, there's no difference between the Dog and Tree roles;
however, this would almost certainly not be the case most of the time - at
the very least, a class with a Dog role would have @.legs, while a class
with the Tree role would
Jonathan Lang [mailto:[EMAIL PROTECTED] wrote:
Austin Hastings wrote:
Indeed. I like the idea of dynamic anonymous roles -- it's more
behavioral than anything else.
sub print_it ($thingie must stringify()) {...}
Definitely gets down to the lowest level quickly, which is nice. Even
From: chromatic [mailto:[EMAIL PROTECTED]
On Wed, 2004-01-07 at 00:43, Jonathan Lang wrote:
Maybe as an alternative to
role Stringify {must stringify();}
sub print_it (Stringify $thingie) {print $thingie.stringify();}
you might be able to say
sub print_it ($thingie must
Austin Hastings wrote:
Jonathan Lang wrote:
Austin Hastings wrote:
This kind of granularity does kind of imply a JavaScript-like
ability to compose objects, too, no? (If you can compose
requirements atomically, why not compose capabilities, too?)
my $photon does Particle does
chromatic [EMAIL PROTECTED] writes:
On Tue, 2004-01-06 at 22:26, Austin Hastings wrote:
So on the grand balance of utility, what are the metrics that traits are
supposed to help improve?
Two big ones:
- naming collections of behavior that are too fine-grained to fit into
classes
Piers Cawley wrote:
Why does it have to be a String, though? What prevents it from
working with anything that can stringify, besides the overly
restrictive signature? What if you could say (the Perl 6 equivalent
of):
sub print_it ( does Stringify $thingie )
{
From: Jonathan Lang [mailto:[EMAIL PROTECTED]
Piers Cawley wrote:
Why does it have to be a String, though? What prevents it from
working with anything that can stringify, besides the overly
restrictive signature? What if you could say (the Perl 6 equivalent
of):
sub
Austin Hastings wrote:
Jonathan Lang wrote:
Maybe as an alternative to
role Stringify {must stringify();}
sub print_it (Stringify $thingie) {print $thingie.stringify();}
you might be able to say
sub print_it ($thingie must stringify()) {
print
On Wed, 2004-01-07 at 00:43, Jonathan Lang wrote:
Maybe as an alternative to
role Stringify {must stringify();}
sub print_it (Stringify $thingie) {print $thingie.stringify();}
you might be able to say
sub print_it ($thingie must stringify()) {print $thingie.stringify();}
Larry, chromatic, Allison, Damian, et al:
What's the big fascination with traits?
I read the paper, and at the end where they talked about refactoring the
Smalltalk class library, they managed to claim 12% fewer lines of code:
In total, these classes use 46 different traits and implement 509
On Tue, 2004-01-06 at 22:26, Austin Hastings wrote:
So on the grand balance of utility, what are the metrics that traits are
supposed to help improve?
Two big ones:
- naming collections of behavior that are too fine-grained to fit into
classes cleanly
- enabling finer-grained
12 matches
Mail list logo