Re: Run time dispatch on ~~

2006-07-14 Thread Aaron Sherman
On Fri, 2006-07-14 at 00:08 +0300, Yuval Kogman wrote: Also, sometimes i am matching on behalf of my caller, this is very common in dispatch algorithms, or things like tree visitors: my @list = $tree.filter_children( $match ); # very generic and useful It's really the fact that that's

Re: Run time dispatch on ~~

2006-07-14 Thread Dr.Ruud
Aaron Sherman schreef: given $_ { when $x {...} } or $_ ~~ $x Can that be written as .~~ $x? -- Affijn, Ruud Gewoon is een tijger.

Re: Run time dispatch on ~~

2006-07-14 Thread Larry Wall
On Fri, Jul 14, 2006 at 04:34:26PM +0200, Dr.Ruud wrote: : Aaron Sherman schreef: : : given $_ { : when $x {...} : } : : or : : $_ ~~ $x : : Can that be written as .~~ $x? No, but you might just possibly get away with writing: .infix:~~($x) assuming that the $_.foo($x) SMD

Re: Run time dispatch on ~~

2006-07-14 Thread Dr.Ruud
Larry Wall schreef: Dr.Ruud: Aaron Sherman: $_ ~~ $x Can that be written as .~~ $x? No, but you might just possibly get away with writing: .infix:~~($x) assuming that the $_.foo($x) SMD eventually fails over to foo($_,$x) MMD. But that doesn't seem to be much of an improvement

Run time dispatch on ~~

2006-07-13 Thread Aaron Sherman
Perl would do anything other than an only slightly smart comparison there, since that's obviously what the programmer had in mind. However, S03 specs that ~~ will do a run-time dispatch based on the type of that value at the time. Matching Arrays (@~~@) is just a hyperoperated case of the same problem

Re: Run time dispatch on ~~

2006-07-13 Thread Yuval Kogman
On Thu, Jul 13, 2006 at 15:44:33 -0400, Aaron Sherman wrote: Now, let's look at some of the good that ~~ does for us: $a ~~ Some string # sameness $a ~~ 5 # sameness $a ~~ -{...} # test $a ~~ /.../ # regex matching That's great, and