Roles as anonymous and/or closures

2005-04-26 Thread Aaron Sherman
Is any of this legal? class car { ... method make ($self: $make, [EMAIL PROTECTED]) returns(car) { return $self but role { has $.make = $make; method model($self:

Re: Roles as anonymous and/or closures

2005-04-26 Thread Juerd
All IIRC/AFAIK: Aaron Sherman skribis 2005-04-26 9:25 (-0400): method make ($self: $make, [EMAIL PROTECTED]) returns(car) { returns car; (And write classes ucfirst, please) return $self but role { does role { ... } It certainly seems very

Re: Roles as anonymous and/or closures

2005-04-26 Thread Aaron Sherman
standard for a factory type method (I think I said generator before, oops), but in most languages, a factory either has to return from a pre-defined tree of classes, or has to build its own mechanism. In Perl 6, closures combined with anonymous roles let us build this functionality trivially, on the fly

Re: Roles as anonymous and/or closures

2005-04-26 Thread Luke Palmer
Juerd writes: (And write classes ucfirst, please) return $self but role { does role { ... } Nope, Aaron was right here, since you're not trying to mutate $self; you're just trying to return a new $self with other capabilities. It certainly seems very