Re: not 4,3,2,1,0;

2005-05-17 Thread Autrijus Tang
On Mon, May 16, 2005 at 04:06:15PM -0700, Larry Wall wrote: That's sub not (*args is context(Scalar)) or whatever we end up calling the Any/Scalar type. How about is context(Item) versus is context(Slurpy). :) Also, shouldn't the *args there be [EMAIL PROTECTED] Is it really okay to

Re: not 4,3,2,1,0;

2005-05-17 Thread Larry Wall
On Tue, May 17, 2005 at 02:42:43PM +0800, Autrijus Tang wrote: : On Mon, May 16, 2005 at 04:06:15PM -0700, Larry Wall wrote: : That's : : sub not (*args is context(Scalar)) : : or whatever we end up calling the Any/Scalar type. : : How about is context(Item) versus is context(Slurpy).

Re: not 4,3,2,1,0;

2005-05-17 Thread Juerd
Larry Wall skribis 2005-05-17 1:24 (-0700): : How about is context(Item) versus is context(Slurpy). :) I've been kind of leaning towards Item lately for the Any type, but the other one could just be whatever we end up calling lazy lists, which is probably not Slurpy. Well, slurping and steam

Quick question: '1.28' * '2.56'

2005-05-17 Thread Autrijus Tang
Imagine: pugs '1.28' * '2.56' 3.2768 What is (or should be) going on here here? [1] role NumRole { method infix:* returns Num (NumRole $x, NumRole $y: ) { ... } } Str.does(NumRole); [2] multi sub infix:* (Str $x, Str $y) returns Num { ... } [3] multi sub prefix:+ (Str

Re: Quick question: '1.28' * '2.56'

2005-05-17 Thread Luke Palmer
On 5/17/05, Autrijus Tang [EMAIL PROTECTED] wrote: Imagine: pugs '1.28' * '2.56' 3.2768 What is (or should be) going on here here? ... [6] something else? I still don't quite have a handle on the object system. Maybe: subtype Num of Str where /^ number $/; ? Maybe

Re: Quick question: '1.28' * '2.56'

2005-05-17 Thread Rob Kinyon
Maybe s/Num/NumLike/ or something? Anyway, that's how I think of it at least: not that a Str is converted into a Num, but rather that certain Strs are Nums. If that's the case, then if I change a variable that isa Str (that isa Num), does it change what it inherits from? Rob

Re: Quick question: '1.28' * '2.56'

2005-05-17 Thread Luke Palmer
On 5/17/05, Rob Kinyon [EMAIL PROTECTED] wrote: Maybe s/Num/NumLike/ or something? Anyway, that's how I think of it at least: not that a Str is converted into a Num, but rather that certain Strs are Nums. If that's the case, then if I change a variable that isa Str (that isa Num), does

Multiple colons

2005-05-17 Thread Luke Palmer
Hey grep { !/Luke/ } @Larry, luquimulti foo(Foo, Bar: Baz); # manhattan on Foo and Bar luquimulti foo(Foo: Bar: Baz); # leftmost on Foo and Bar autrijus wtf? autrijus multiple colons? Is that still the case? I don't recall us getting rid of it, but it doesn't seem to

Re: Multiple colons

2005-05-17 Thread Larry Wall
On Tue, May 17, 2005 at 01:50:48PM +, Luke Palmer wrote: : Hey grep { !/Luke/ } @Larry, : : luquimulti foo(Foo, Bar: Baz); # manhattan on Foo and Bar : luquimulti foo(Foo: Bar: Baz); # leftmost on Foo and Bar : autrijus wtf? : autrijus multiple colons? : : Is that

Re: Multiple colons

2005-05-17 Thread Autrijus Tang
On Tue, May 17, 2005 at 07:00:23AM -0700, Larry Wall wrote: On Tue, May 17, 2005 at 01:50:48PM +, Luke Palmer wrote: : Is that still the case? I don't recall us getting rid of it, but it : doesn't seem to be documented in the AES. We didn't get rid of it. So does it mean that a 3-story

Re: Quick question: '1.28' * '2.56'

2005-05-17 Thread TSa (Thomas Sandlaß)
Autrijus Tang wrote: Imagine: pugs '1.28' * '2.56' 3.2768 What is (or should be) going on here here? My personal favorite is [5] none of the above -- that should be a type error. ;) But only if MMD doesn't find a unique handler. That is I would favor 'type error' =:= 'no handler ||

Re: Multiple colons

2005-05-17 Thread Larry Wall
On Tue, May 17, 2005 at 10:10:22PM +0800, Autrijus Tang wrote: : On Tue, May 17, 2005 at 07:00:23AM -0700, Larry Wall wrote: : On Tue, May 17, 2005 at 01:50:48PM +, Luke Palmer wrote: : : Is that still the case? I don't recall us getting rid of it, but it : : doesn't seem to be documented

Re: Multiple colons

2005-05-17 Thread Luke Palmer
On 5/17/05, Larry Wall [EMAIL PROTECTED] wrote: On Tue, May 17, 2005 at 10:10:22PM +0800, Autrijus Tang wrote: : Is the final level ($z and $w) participating in the MMD at all : as tiebreakers? Luke mentioned that in all levels but the final : one, Manhattan distance (sum of inheritance

Re: Multiple colons

2005-05-17 Thread TSa (Thomas Sandlaß)
Autrijus Tang wrote: So does it mean that a 3-story multisub with two colons will always win against one with one colon? multi sub foo (Any $x: Str $y: Str $z, Str $w) { 1 } multi sub foo (Str $x, Str $y: Str $z, Str $w) { 2 } say foo(x, y, z, w); # 1 Is the final level ($z and $w)

multi sub and invocants (related to colon question from earlier)

2005-05-17 Thread Aaron Sherman
There's some ambiguity in A/S 6 that I wanted to ask about. A6 says: Ordinary subs never have an invocant. If you want to declare a non-method subroutine that behaves as a method, you should declare a submethod instead. But S6 changes that without fully explaining

Re: multi sub and invocants (related to colon question from earlier)

2005-05-17 Thread Luke Palmer
On 5/17/05, Aaron Sherman [EMAIL PROTECTED] wrote: Let's say that that's true. You can certainly still end up in conflict: class A {...} my A $a = A.new() but role { method x() {...} } eval 'multi sub x(A $i:) {...}'; Now, the eval should work because A has no x

Closures and CALLER

2005-05-17 Thread Aaron Sherman
Is it a bad sign that I'm still on the first section of S29, getting up to speed? Sigh... I'll get there, really. This is another question from my reading this morning. Ok, so log and log10: multi sub Math::Basic::log (: Num ?$x = $CALLER::_, Num +$base); log10 :=

Re: Quick question: '1.28' * '2.56'

2005-05-17 Thread Larry Wall
On Tue, May 17, 2005 at 09:04:19PM +0800, Autrijus Tang wrote: : Imagine: : : pugs '1.28' * '2.56' : 3.2768 : : What is (or should be) going on here here? : : [1] role NumRole { : method infix:* returns Num (NumRole $x, NumRole $y: ) { ... } : } : Str.does(NumRole); : :

Re: Closures and CALLER

2005-05-17 Thread Rod Adams
Aaron Sherman wrote: Ok, so log and log10: multi sub Math::Basic::log (: Num ?$x = $CALLER::_, Num +$base); log10 := log.assuming:base(10); What does log get in this case: for @x { log10(); } Does the curried log10 execute the defaulting for the sub

Re: Nested captures

2005-05-17 Thread Peter Haworth
On Mon, 09 May 2005 22:51:53 +1000, Damian Conway wrote: # Perl 6... # $1 $2$3 $4$5 $6 $tune_up6 = rx/ (don't) (ray) (me) (for) (solar tea), (d'oh!) # $1 $2 $3$4$5 | (every)

Re: Multiple colons

2005-05-17 Thread Autrijus Tang
On Tue, May 17, 2005 at 07:26:54AM -0700, Larry Wall wrote: It does seem that the signature that provides more information should be rewarded for that somehow. Maybe it's most useful if non-invocant args (or non-invocant-YET args, in this case) are just considered to be at Any distance when

Re: Nested captures

2005-05-17 Thread Mark Reed
On 2005-05-17 14:14, Peter Haworth [EMAIL PROTECTED] wrote:\ Does numbering of captures after an alternation continue as if the alternative with the most captures matched? # $1$1 $2$3, even if (a) matched rx/ [ (a) | (b) (c) ] (d) /; I thought that was still like

Re: Multiple colons

2005-05-17 Thread Autrijus Tang
On Tue, May 17, 2005 at 02:45:58PM +, Luke Palmer wrote: Just for the folks not following along on IRC, I don't think I implied that. But Autrijus apparently inferred it :-). My apologies. It's a misparse on my part. Anyway, there is no MMD whatsoever on the final level, so that:

Re: Nested captures

2005-05-17 Thread Jonathan Scott Duff
On Tue, May 17, 2005 at 03:02:12PM -0400, Mark Reed wrote: On 2005-05-17 14:14, Peter Haworth [EMAIL PROTECTED] wrote:\ Does numbering of captures after an alternation continue as if the alternative with the most captures matched? # $1$1 $2$3, even if (a) matched

Re: Multiple colons

2005-05-17 Thread Larry Wall
On Wed, May 18, 2005 at 04:02:16AM +0800, Autrijus Tang wrote: : Hmm. How does this play with Larry's suggestion: : : I suppose one could even install a colon on the end of the return : type to request that explicitly. : : Does it mean that: : : multi sub foo(Foo: Bar: Baz:)

Re: Closures and CALLER

2005-05-17 Thread Larry Wall
On Tue, May 17, 2005 at 01:01:48PM -0500, Rod Adams wrote: : Aaron Sherman wrote: : : Ok, so log and log10: : : multi sub Math::Basic::log (: Num ?$x = $CALLER::_, Num +$base); : log10 := log.assuming:base(10); : : What does log get in this case: : : for @x { :

Re: Quick question: '1.28' * '2.56'

2005-05-17 Thread Sam Vilain
Rob Kinyon wrote: If that's the case, then if I change a variable that isa Str (that isa Num), does it change what it inherits from? Please don't use inherits when talking about these core types. Classical inheritance just doesn't work with the varied sets of numbers. All those stories you were

Re: Quick question: '1.28' * '2.56'

2005-05-17 Thread Sam Vilain
Larry Wall wrote: : pugs '1.28' * '2.56' : 3.2768 : What is (or should be) going on here here? : [1] role NumRole { : method infix:* returns Num (NumRole $x, NumRole $y: ) { ... } : } : Str.does(NumRole); : [3] multi sub prefix:+ (Str $x) returns Num { ... } : multi sub