Re: YAPC::EU and Perl 6 Roles

2009-07-15 Thread Raphael Descamps
Am Freitag, den 10.07.2009, 17:06 -0700 schrieb Jon Lang: How about this: in role composition, mandate causes methods to take precedence over other methods with which they would normally conflict, and to conflict with methods that would normally take precedence over them. I really dislike

Re: YAPC::EU and Perl 6 Roles

2009-07-15 Thread Jon Lang
Raphael Descamps wrote: Am Freitag, den 10.07.2009, 17:06 -0700 schrieb Jon Lang: How about this: in role composition, mandate causes methods to take precedence over other methods with which they would normally conflict, and to conflict with methods that would normally take precedence over

Re: YAPC::EU and Perl 6 Roles

2009-07-15 Thread TSa
HaloO, Jon Lang wrote: I'd still like to get a synonym for mandate role, though - a word that captures the meaning of unit of behavior. A bit burdened with conflicting meaning but I think mixin is what you are looking for. Regards, TSa. -- The unavoidable price of reliability is simplicity

Re: YAPC::EU and Perl 6 Roles

2009-07-15 Thread TSa
HaloO, Jon Lang wrote: Well, yes and no. The class still has the final say on how a given method is to be implemented; the only thing being debated here is whether or not the class should have to explicitly pull rank to redefine a method being provided by a role, or if it does so silently.

Re: YAPC::EU and Perl 6 Roles

2009-07-15 Thread Jon Lang
TSa wrote: HaloO, Jon Lang wrote: Well, yes and no.  The class still has the final say on how a given method is to be implemented; the only thing being debated here is whether or not the class should have to explicitly pull rank to redefine a method being provided by a role, or if it does

Re: YAPC::EU and Perl 6 Roles

2009-07-10 Thread David Green
On 2009-Jul-8, at 1:49 pm, Ovid wrote: That being said, roles also have two competing uses (though they don't conflict as badly). As units of behavior, they provide the functionality your code needs. However, they can also serve as an interface. Maybe there are Interfaces, which are,

Re: YAPC::EU and Perl 6 Roles

2009-07-10 Thread Jon Lang
Larry Wall wrote: Dave Whipp wrote: Ovid wrote: I'd like to see something like this (or whatever the equivalent Perl 6 syntax would be):   class PracticalJoke does Bomb does SomeThingElse {     method fuse() but overrides { ... }   } The overrides tells Perl 6 that we're overriding the

Re: YAPC::EU and Perl 6 Roles

2009-07-10 Thread Jon Lang
Jon Lang wrote: supersede already has a meaning with respect to classes; and what I'm thinking of would apply to classes as well as roles; so I'm going to suggest another keyword. How about this: in role composition, mandate causes methods to take precedence over other methods with which

Re: YAPC::EU and Perl 6 Roles

2009-07-08 Thread Ovid
- Original Message From: Timothy S. Nelson wayl...@wayland.id.au class PracticalJoke { has Bomb $bomb handles ; has Spouse $spouse handles ; } Note that I have no idea where (if anywhere) the type goes in this. Hopefully someone will correct me here. Note that

Re: YAPC::EU and Perl 6 Roles

2009-07-08 Thread Timothy S. Nelson
On Wed, 8 Jul 2009, Ovid wrote: Note that I have no idea where (if anywhere) the type goes in this. Hopefully someone will correct me here. Note that this does not use the roles as roles; it uses them punned as classes. But it does what you asked :). Though I have issues with

Re: YAPC::EU and Perl 6 Roles

2009-07-08 Thread Jonathan Worthington
Ovid wrote: - Original Message From: Timothy S. Nelson wayl...@wayland.id.au class PracticalJoke { has Bomb $bomb handles ; has Spouse $spouse handles ; } Note that I have no idea where (if anywhere) the type goes in this. Hopefully someone will correct me here. Note

Re: YAPC::EU and Perl 6 Roles

2009-07-08 Thread Jon Lang
Jonathan Worthingtonjonat...@jnthn.net wrote: Ovid wrote: Though I have issues with Jonathan's approach (I don't like classes silently discarding role methods as this has caused us many bugs at the BBC), it's much cleaner that what I see here. s/Jonathan's approach/Perl 6's approach/ # at

Re: YAPC::EU and Perl 6 Roles

2009-07-08 Thread Jonathan Worthington
Jon Lang wrote: Jonathan Worthingtonjonat...@jnthn.net wrote: Ovid wrote: Though I have issues with Jonathan's approach (I don't like classes silently discarding role methods as this has caused us many bugs at the BBC), it's much cleaner that what I see here. s/Jonathan's

Re: YAPC::EU and Perl 6 Roles

2009-07-08 Thread Jonathan Worthington
Hi, Going back to the original question... Ovid wrote: It needs the timed fuse() from a Bomb role and a non-lethal explode() from a Spouse role, though each role provides both methods. I'm curious... 1) How often do you in real life find yourself needing to do things like this in real

Re: YAPC::EU and Perl 6 Roles

2009-07-08 Thread Kyle Hasselbacher
On Tue, Jul 7, 2009 at 7:13 AM, Jonathan Worthingtonjonat...@jnthn.net wrote: (Note to the bored: feel free to beat me to adding something like these last two to the spectests...I'm away for the afternoon/evening.) In r27483, I added these tests to S12-methods/multi.t:

Re: YAPC::EU and Perl 6 Roles

2009-07-08 Thread Ovid
- Original Message From: Jonathan Worthington jonat...@jnthn.net Ovid wrote: It needs the timed fuse() from a Bomb role and a non-lethal explode() from a Spouse role, though each role provides both methods. I'm curious... 1) How often do you in real life find yourself

Private methods in Roles (Was: Re: YAPC::EU and Perl 6 Roles)

2009-07-08 Thread Daniel Ruoso
Em Qua, 2009-07-08 às 12:49 -0700, Ovid escreveu: Behavioral: if you are primarily relying on roles to provide behavior (as we do at the BBC), then silently discarding the role's behavior by providing a method of the same name in your class can lead to very confusing bugs. I've lost a lot of

Re: YAPC::EU and Perl 6 Roles

2009-07-08 Thread Dave Whipp
Ovid wrote: I'd like to see something like this (or whatever the equivalent Perl 6 syntax would be): class PracticalJoke does Bomb does SomeThingElse { method fuse() but overrides { ... } } The overrides tells Perl 6 that we're overriding the fuse() method from either Bomb or

Re: YAPC::EU and Perl 6 Roles

2009-07-08 Thread Larry Wall
On Wed, Jul 08, 2009 at 01:59:53PM -0700, Dave Whipp wrote: Ovid wrote: I'd like to see something like this (or whatever the equivalent Perl 6 syntax would be): class PracticalJoke does Bomb does SomeThingElse { method fuse() but overrides { ... } } The overrides tells Perl 6

Re: YAPC::EU and Perl 6 Roles

2009-07-07 Thread Jon Lang
On Tue, Jul 7, 2009 at 2:48 AM, Ovidpubliustemp-perl6langua...@yahoo.com wrote: Giving a talk about roles at YAPC::EU in Lisbon and I'm a bit stuck on how to translate a Perl 5 example into Perl 6.  Basically, Imagine a PracticalJoke class which has fuse() and explode methods().  It needs

Re: YAPC::EU and Perl 6 Roles

2009-07-07 Thread Jonathan Worthington
Ovid wrote: Giving a talk about roles at YAPC::EU in Lisbon Hey, me too! :-) and I'm a bit stuck on how to translate a Perl 5 example into Perl 6. Basically, Imagine a PracticalJoke class which has fuse() and explode methods(). It needs the timed fuse() from a Bomb role and a non-lethal

Re: YAPC::EU and Perl 6 Roles

2009-07-07 Thread Jonathan Worthington
Jon Lang wrote: I believe that the official word is to say: class PracticalJoke does Bomb does Spouse { method fuse () { Bomb::fuse } method explode () { Spouse::explode } } This way won't work, because: * It's doing a sub call to something that's a method * The lookup won't

Re: YAPC::EU and Perl 6 Roles

2009-07-07 Thread Brandon S. Allbery KF8NH
On Jul 7, 2009, at 07:34 , Jonathan Worthington wrote: Jon Lang wrote: I believe that the official word is to say: class PracticalJoke does Bomb does Spouse { method fuse () { Bomb::fuse } method explode () { Spouse::explode } } This way won't work, because: * It's doing a sub call

Re: YAPC::EU and Perl 6 Roles

2009-07-07 Thread Jonathan Worthington
Brandon S. Allbery KF8NH wrote: On Jul 7, 2009, at 07:34 , Jonathan Worthington wrote: Jon Lang wrote: I believe that the official word is to say: class PracticalJoke does Bomb does Spouse { method fuse () { Bomb::fuse } method explode () { Spouse::explode } } This way won't work,

Re: YAPC::EU and Perl 6 Roles

2009-07-07 Thread Brandon S. Allbery KF8NH
On Jul 7, 2009, at 08:13 , Jonathan Worthington wrote: Brandon S. Allbery KF8NH wrote: I was trying to figure out how to do it with nextsame, but that's not looking very simple. On the other hand, if they were multis then they get added to the multi candidate list and therefore you can

Re: YAPC::EU and Perl 6 Roles

2009-07-07 Thread Jonathan Worthington
Brandon S. Allbery KF8NH wrote: On Jul 7, 2009, at 08:13 , Jonathan Worthington wrote: Brandon S. Allbery KF8NH wrote: I was trying to figure out how to do it with nextsame, but that's not looking very simple. On the other hand, if they were multis then they get added to the multi candidate

Re: YAPC::EU and Perl 6 Roles

2009-07-07 Thread Timothy S. Nelson
On Tue, 7 Jul 2009, Ovid wrote: role Bomb { method fuse (){ say '3 .. 2 .. 1 ..' } method explode () { say 'Rock falls. Everybody dies!' } } role Spouse { method fuse (){ sleep rand(20); say Now! } method explode () { say 'You worthless piece of junk! Why I should ...' }