RFC: overriding methods declared by roles (Was: Re: Reusing code: Everything but the kitchen sink)

2009-07-12 Thread Daniel Ruoso
Em Sex, 2009-07-10 às 15:39 -0700, Jon Lang escreveu: The key to understanding roles is to note that roles don't implement methods; classes implement methods. Er, while I see your point, Roles are not just interfaces... they are OO components that can be plugged into other classes. They often

.match and .subst set outer $/?

2009-07-12 Thread Moritz Lenz
payload++ brought this up on #perl6: in current Rakudo, $string ~~ /re/ sets $/ in the scope in which the expression appears, ie 'a' ~~ /./; say $/; # ouput: a But $str.match(..) and $str.subst don't. The spec is rather silent, it says There are also method forms of m// and s///: [...]

Re: .match and .subst set outer $/?

2009-07-12 Thread Daniel Ruoso
Em Dom, 2009-07-12 às 22:51 +0200, Moritz Lenz escreveu: I setting of OUTER::$/ considered syntactic sugar? I don't care either way, I'd just like some clarification so that I can write tests and submit tickets (if appropriate). As far as I remember, it's not really OUTER::$/, but each routine

Re: Reusing code: Everything but the kitchen sink

2009-07-12 Thread David Green
On 2009-Jul-10, at 4:37 pm, Jon Lang wrote: This is one of the distinctions between role composition and class inheritance. With class inheritance, the full tree of inherited classes is publicly accessible; with role composition, the methods of the combined role are the only ones that are

Re: RFC: overriding methods declared by roles (Was: Re: Reusing code: Everything but the kitchen sink)

2009-07-12 Thread David Green
On 2009-Jul-12, at 12:43 pm, Daniel Ruoso wrote: role R1 { method foo() {...} # degenerates to interface } Just wondering: since merely declaring an interface will be common enough, should we be able to say simply method foo; inside a role, and drop the {...}? class Bla does R2 {

Re: Reusing code: Everything but the kitchen sink

2009-07-12 Thread Brandon S. Allbery KF8NH
On Jul 12, 2009, at 20:15 , David Green wrote: sub nighttime (Canine $rover) { $rover.bark if any(burglars()); } (...) 3) $rover acts like a Canine, but the rest of the original $dogwood arg (the Tree parts) are still there; they just aren't used unless somehow explicitly brought out; for

Re: RFC: overriding methods declared by roles (Was: Re: Reusing code: Everything but the kitchen sink)

2009-07-12 Thread Jon Lang
Daniel Ruoso wrote: Jon Lang wrote: The key to understanding roles is to note that roles don't implement methods; classes implement methods. Er, while I see your point, Roles are not just interfaces... they are OO components that can be plugged into other classes. They often are used for