Re: ===, =:=, ~~, eq and == revisited (blame ajs!) -- Explained

2006-07-14 Thread Darren Duncan
I think that Jonathan meant for his reply to my message to go to the list, so I am including it in its entirety, in my reply. At 11:23 PM -0700 7/13/06, Jonathan Lang wrote: Darren Duncan wrote: Jonathan Lang wrote: So the purpose of === is to provide a means of comparison that doesn't

optimizing with === immutable comparitor

2006-07-14 Thread Darren Duncan
This may go without saying, but ... If $a === $b means what I think it does, then I believe that a not-premature implementation optimization of === would be that it always $a := $b if it was returning true, so that any future === of $a and $b or aliases thereof could short-circuit with a =:=

Re: optimizing with === immutable comparitor

2006-07-14 Thread chromatic
On Friday 14 July 2006 00:30, Darren Duncan wrote: This may go without saying, but ... If $a === $b means what I think it does, then I believe that a not-premature implementation optimization of === would be that it always $a := $b if it was returning true, so that any future === of $a and

CORRECTION: optimizing with === immutable comparitor

2006-07-14 Thread Darren Duncan
At 12:30 AM -0700 7/14/06, Darren Duncan wrote: If $a === $b means what I think it does, then I believe that a not-premature implementation optimization of === would be that it always $a := $b if it was returning true, so that any future === of $a and $b or aliases thereof could short-circuit

Re: ===, =:=, ~~, eq and == revisited (blame ajs!) -- Explained

2006-07-14 Thread Smylers
Yuval Kogman writes: So, Larry assisted by Audrey explained the purpose of === vs eqv vs =:=. I'm afraid I still don't get it. Or rather, while I can manage to read an explanation of what one of these operators does and see how it applies to the variables in the examples next to it, I am

Re: CORRECTION: optimizing with === immutable comparitor

2006-07-14 Thread Ruud H.G. van Tol
Darren Duncan schreef: What I propose concerning non-premature === optimizing is a system where, at any time that two appearances of the same immutable value are compared with ===, they are immediately consolidated into a single appearance. That should only be done voluntarily. A bit like

Re: ===, =:=, ~~, eq and == revisited (blame ajs!) -- Explained

2006-07-14 Thread Yuval Kogman
On Fri, Jul 14, 2006 at 11:42:24 +0100, Smylers wrote: I'm afraid I still don't get it. Or rather, while I can manage to read an explanation of what one of these operators does and see how it applies to the variables in the examples next to it, I am struggling to retain a feeling of _why_ I

Re: optimizing with === immutable comparitor

2006-07-14 Thread Yuval Kogman
On Fri, Jul 14, 2006 at 00:30:20 -0700, Darren Duncan wrote: This may go without saying, but ... ... This is a VM issue. It clarifies semantics, and the runtime VM may choose to do this freely for simple values (but not for objects which just pretend using .id). In short: yes, the semantics

Re: ===, =:=, ~~, eq and == revisited (blame ajs!) -- Explained

2006-07-14 Thread Smylers
Yuval Kogman writes: On Fri, Jul 14, 2006 at 11:42:24 +0100, Smylers wrote: Or rather, while I can manage to read an explanation of what one of these operators does and see how it applies to the variables in the examples next to it, I am struggling to retain a feeling of _why_ I would

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: ===, =:=, ~~, eq and == revisited (blame ajs!) -- Explained

2006-07-14 Thread Mark A. Biggar
Darren Duncan wrote: Now, I didn't see them yet anywhere in Synopsis 3, but I strongly recommend having negated versions of all these various types of equality tests. Eg, !== for ===, nev for eqv, etc. They would be used very frequently, I believe (and I have even tried to do so), and of

Re: ===, =:=, ~~, eq and == revisited (blame ajs!) -- Explained

2006-07-14 Thread Dave Whipp
Darren Duncan wrote: Assuming that all elements of $a and $b are themselves immutable to all levels of recursion, === then does a full deep copy like eqv. If at any level we get a mutable object, then at that point it turns into =:= (a trivial case) and stops. ( 1, 2.0, 3 ) === ( 1,2,3 )

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: ===, =:=, ~~, eq and == revisited (blame ajs!) -- Explained

2006-07-14 Thread Dr.Ruud
Mark A. Biggar schreef: Darren Duncan: Now, I didn't see them yet anywhere in Synopsis 3, but I strongly recommend having negated versions of all these various types of equality tests. Eg, !== for ===, nev for eqv, etc. They would be used very frequently, I believe (and I have even tried

Re: ===, =:=, ~~, eq and == revisited (blame ajs!) -- Explained

2006-07-14 Thread Darren Duncan
At 9:22 AM -0700 7/14/06, Dave Whipp wrote: Darren Duncan wrote: Assuming that all elements of $a and $b are themselves immutable to all levels of recursion, === then does a full deep copy like eqv. If at any level we get a mutable object, then at that point it turns into =:= (a trivial

Fwd: ===, =:=, ~~, eq and == revisited (blame ajs!) -- Explained

2006-07-14 Thread Jonathan Lang
Dave Whipp wrote: Darren Duncan wrote: Assuming that all elements of $a and $b are themselves immutable to all levels of recursion, === then does a full deep copy like eqv. If at any level we get a mutable object, then at that point it turns into =:= (a trivial case) and stops. ( 1,

Re: ===, =:=, ~~, eq and == revisited (blame ajs!) -- Explained

2006-07-14 Thread Darren Duncan
At 6:55 PM +0200 7/14/06, Dr.Ruud wrote: say foo if $x !== $y; into say foo unless $x === $y; And how about symmetry: say foo unless $y === $x; very unreliable. Any equality or inequality operator is commutative, so it doesn't matter whether you have $x and $y or $y and $x,

Re: ===, =:=, ~~, eq and == revisited (blame ajs!) -- Explained

2006-07-14 Thread Larry Wall
On Thu, Jul 13, 2006 at 10:56:59PM -0700, Darren Duncan wrote: : Now, I didn't see them yet anywhere in Synopsis 3, but I strongly : recommend having negated versions of all these various types of : equality tests. Eg, !== for ===, nev for eqv, etc. They would be : used very frequently, I

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

Re: ===, =:=, ~~, eq and == revisited (blame ajs!) -- Explained

2006-07-14 Thread Darren Duncan
At 12:55 PM -0700 7/14/06, Larry Wall wrote: On Thu, Jul 13, 2006 at 10:56:59PM -0700, Darren Duncan wrote (edited): : Now, I didn't see them yet anywhere in Synopsis 3, but I strongly : recommend having negated versions of all these various types of : equality tests. Eg, !=== for ===, !eqv for

Re: ===, =:=, ~~, eq and == revisited (blame ajs!) -- Explained

2006-07-14 Thread Yuval Kogman
On Fri, Jul 14, 2006 at 09:22:10 -0700, Dave Whipp wrote: Darren Duncan wrote: Assuming that all elements of $a and $b are themselves immutable to all levels of recursion, === then does a full deep copy like eqv. If at any level we get a mutable object, then at that point it turns into

Re: ===, =:=, ~~, eq and == revisited (blame ajs!) -- Explained

2006-07-14 Thread Dr.Ruud
Darren Duncan schreef: Dr.Ruud: say foo if $x !== $y; into say foo unless $x === $y; And how about symmetry: say foo unless $y === $x; Any equality or inequality operator is commutative, If $x and $y are not of the same type, and one or both of the involved types has its own

Re: ===, =:=, ~~, eq and == revisited (blame ajs!) -- Explained

2006-07-14 Thread Charles Bailey
On 7/14/06, David Green [EMAIL PROTECTED] wrote: On 7/13/06, Yuval Kogman wrote: So, Larry assisted by Audrey explained the purpose of === vs eqv vs =:=. It makes sense now, but I still feel that as far as ergonomics go this is not perfect. I think I understand it... (my only quibble with the

Re: ===, =:=, ~~, eq and == revisited (blame ajs!) -- Explained

2006-07-14 Thread Larry Wall
On Thu, Jul 13, 2006 at 10:19:24PM -0600, David Green wrote: : On 7/13/06, Yuval Kogman wrote: : So, Larry assisted by Audrey explained the purpose of === vs eqv vs =:=. : It makes sense now, but I still feel that as far as ergonomics go : this is not perfect. : : I think I understand it... (my

[svn:perl6-synopsis] r10215 - doc/trunk/design/syn

2006-07-14 Thread larry
Author: larry Date: Fri Jul 14 17:00:12 2006 New Revision: 10215 Modified: doc/trunk/design/syn/S03.pod Log: Differentiate === from eqv and clarify semantics. Redefine cmp and add leg operator for old semantics. Add ! metaoperator. Fix random typos. Modified: doc/trunk/design/syn/S03.pod

Re: [svn:perl6-synopsis] r10215 - doc/trunk/design/syn

2006-07-14 Thread Darren Duncan
At 5:00 PM -0700 7/14/06, [EMAIL PROTECTED] wrote: Author: larry Date: Fri Jul 14 17:00:12 2006 New Revision: 10215 Modified: doc/trunk/design/syn/S03.pod Log: Differentiate === from eqv and clarify semantics. Redefine cmp and add leg operator for old semantics. Add ! metaoperator. Fix