Re: Aliasing methods in CPAN roles

2009-10-20 Thread Raphael Descamps
Am Montag, den 19.10.2009, 16:43 -0700 schrieb Jon Lang: > Raphael Descamps wrote: > > I personally don't understand why we don't have a exclude and alias > > operator in Perl 6 but I have not read all the synopses and don't have > > an overview. > > I don't think that it's explicitly spelled out

Re: Aliasing methods in CPAN roles

2009-10-19 Thread Jon Lang
Raphael Descamps wrote: > In the original traits paper the aliasing is not "deep": to respect the > flattening property, the semantic of the role must not change, so > aliasing a recursive method will call the original method. It's a known > theoretical weakness of the traits paper and "freezing ro

Re: Aliasing methods in CPAN roles

2009-10-19 Thread Jon Lang
Raphael Descamps wrote: > I personally don't understand why we don't have a exclude and alias > operator in Perl 6 but I have not read all the synopses and don't have > an overview. I don't think that it's explicitly spelled out anywhere; but the reason is fairly straightforward: exclude and alias

Re: Aliasing methods in CPAN roles

2009-10-19 Thread David Green
On 2009-Oct-18, at 3:44 pm, Jon Lang wrote: David Green wrote: I would expect that role Logging { method log(Numeric $x:) {...} } means the invocant is really of type Numeric & Logging, without Logging having to do Numeric. On the other hand, I can see that strictly that might not make se

Re: Aliasing methods in CPAN roles

2009-10-19 Thread Raphael Descamps
Am Freitag, den 16.10.2009, 10:54 +0400 schrieb Richard Hainsworth: > Arising out of "Freezing Roles" is a related question. > > Suppose I download a module from CPAN with a role I want to use, but it > introduces a method that I want that is in conflict with an existing > method (say one taken

Re: Aliasing methods in CPAN roles

2009-10-18 Thread Jon Lang
David Green wrote: > Jon Lang wrote: >> >> This implies that both Logging and Math do Numeric, since the invocant >> ought to be of a type that the class does. > > I would expect that >    role Logging { method log(Numeric $x:) {...} } > means the invocant is really of type Numeric & Logging, witho

Re: Aliasing methods in CPAN roles

2009-10-18 Thread David Green
On 2009-Oct-17, at 1:55 am, Jon Lang wrote: This implies that both Logging and Math do Numeric, since the invocant ought to be of a type that the class does. I would expect that role Logging { method log(Numeric $x:) {...} } means the invocant is really of type Numeric & Logging, without

Re: Aliasing methods in CPAN roles

2009-10-17 Thread Jon Lang
David Green wrote: > Aha, so the bark:(Dog:) syntax identifies the method by its signature as > well, thus distinguishing it from the .bark:(Tree:) method.  This works fine > when the sigs can distinguish the invocants, which is very common.  However, > I could have ambiguous methods even including

Re: Aliasing methods in CPAN roles

2009-10-16 Thread David Green
On 2009-Oct-16, at 12:54 am, Richard Hainsworth wrote: Is there syntactic sugar for aliasing the conflicting method? Eg. something like does XML :db-write; There needs to be something more than sugar: making a new class or role with different methods will break substitutability. However, w

Aliasing methods in CPAN roles

2009-10-15 Thread Richard Hainsworth
Arising out of "Freezing Roles" is a related question. Suppose I download a module from CPAN with a role I want to use, but it introduces a method that I want that is in conflict with an existing method (say one taken from another CPAN module). How should the method be aliased to prevent it f