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

2006-07-12 Thread Smylers
[EMAIL PROTECTED] commits: New Revision: 10077 Modified: doc/trunk/design/syn/S02.pod == -foo.bar # foo().bar -- postfix prevents args +foo.bar # foo().bar -- illegal postfix,

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

2006-07-12 Thread Aaron Sherman
Smylers wrote: [EMAIL PROTECTED] commits: New Revision: 10077 Modified: doc/trunk/design/syn/S02.pod == -foo.bar # foo().bar -- postfix prevents args +foo.bar# foo().bar -- illegal

Easy Str === Str question: what is a reference type

2006-07-12 Thread Aaron Sherman
S03 says: Binary === tests type and value correspondence: for two value types, tests whether they are the same value (eg. 1 === 1); for two reference types, checks whether they have the same identity value. For reference types that do not define an identity, the

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

2006-07-12 Thread Yuval Kogman
Over at #perl6 we had a short discussion on =:=, ===, and ~~, mostly raised by ajs's discussion on Str items and ===. After a brief discussion we managed to formulate several questions that we feel are slightly to totally unresolved. 1. what is .id on references? Is it related to the memory

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

2006-07-12 Thread Yuval Kogman
If we do have deep value equality checks, then default == and eq are probably: sub infix:== ( $x, $y ) { +$x === +$y; } sub infix:eq ( $x, $y ) { ~$x === ~$y; } So that the compare-as-sometype behavior is retained from perl 5

Another quick one: .asancestor

2006-07-12 Thread Aaron Sherman
I would assume that all classes automatically define: multi submethod *infix:as ($self: $?CLASS) { $self } so that derived classes can automatically: $obj.asancestor Without actually changing their implementation details (only the type that Perl currently thinks it's dealing with

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

2006-07-12 Thread Yuval Kogman
Jedai and I went through some of pugs current implementations. Here's a list of what we expect the operators to return and what they currently do. This does not exactly agree with S03 right now, but is our opinion. Force into a type before comparing values: 42 == 42 - true, same numeric

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

2006-07-12 Thread Larry Wall
On Wed, Jul 12, 2006 at 08:40:53AM -0400, Aaron Sherman wrote: : Smylers wrote: : [EMAIL PROTECTED] commits: : : : New Revision: 10077 : Modified: doc/trunk/design/syn/S02.pod : == : : -foo.bar#

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

2006-07-12 Thread Aaron Sherman
On Wed, 2006-07-12 at 19:25 +0300, Yuval Kogman wrote: Over at #perl6 we had a short discussion on =:=, ===, and ~~, mostly raised by ajs's discussion on Str items and ===. *wave* 1. what is .id on references? Is it related to the memory slot, like refaddr() in Perl 5? That's something I'm

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

2006-07-12 Thread Jonathan Scott Duff
On Wed, Jul 12, 2006 at 04:16:13PM -0400, Aaron Sherman wrote: On Wed, 2006-07-12 at 19:25 +0300, Yuval Kogman wrote: 4. will we have a deep (possibly optimized[1]) equality operator, that *will* return true for @foo = ( [ 1, 2 ], 3 ); @bar = ( [ 1, 2 ], 3 ); op(@foo, @bar)? Is it going

Re: Easy Str === Str question: what is a reference type

2006-07-12 Thread David Green
On 7/12/06, Aaron Sherman wrote: There's a problem here, from my point of view. I'll take it one assumption at a time: * $whatever.asObject.id ~~ $whateverelse.asObject.id is true if and only if $whatever := $whateverelse at some point in the past, either explicitly, or

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

2006-07-12 Thread Aaron Sherman
On Wed, 2006-07-12 at 15:32 -0500, Jonathan Scott Duff wrote: On Wed, Jul 12, 2006 at 04:16:13PM -0400, Aaron Sherman wrote: On Wed, 2006-07-12 at 19:25 +0300, Yuval Kogman wrote: 4. will we have a deep (possibly optimized[1]) equality operator, that *will* return true for @foo = ( [ 1, 2

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

2006-07-12 Thread Yuval Kogman
On Wed, Jul 12, 2006 at 16:16:13 -0400, Aaron Sherman wrote: Isn't that ~~? Per S03: Array Array arrays are comparablematch if $_ »~~« $x ~~ is really the all-purpose, bake-your-bread, clean-your-floors, wax-your-cat operator that you're looking for. Not at all,

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

2006-07-12 Thread Yuval Kogman
On Wed, Jul 12, 2006 at 17:58:03 -0400, Aaron Sherman wrote: Then ~~ is wrong in that respect, and I think we should be talking about that, not about making === into ~~, but without invoking code when it shouldn't. But it should! It's the smart match! If the rhs matches the code ref (the code

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

2006-07-12 Thread Yuval Kogman
On Wed, Jul 12, 2006 at 16:16:13 -0400, Aaron Sherman wrote: The other way to think about === would be that it tells you if its LHS *could* be constant-folded onto its RHS (if it were constant for long enough) What is the benefit here? Because of the word deep. Deep implies arbitrary work,

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

2006-07-12 Thread larry
Author: larry Date: Wed Jul 12 18:05:24 2006 New Revision: 10156 Modified: doc/trunk/design/syn/S02.pod doc/trunk/design/syn/S03.pod Log: Clarifications from Smylers++ and ajs++. Modified: doc/trunk/design/syn/S02.pod

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

2006-07-12 Thread Aaron Sherman
Yuval Kogman wrote: On Wed, Jul 12, 2006 at 17:58:03 -0400, Aaron Sherman wrote: Then ~~ is wrong in that respect, and I think we should be talking about that, not about making === into ~~, but without invoking code when it shouldn't. But it should! It's the smart match! If the rhs

Re: Another quick one: .asancestor

2006-07-12 Thread Larry Wall
On Wed, Jul 12, 2006 at 12:51:57PM -0400, Aaron Sherman wrote: : I would assume that all classes automatically define: : : multi submethod *infix:as ($self: $?CLASS) { $self } Hmm, as is really only intended for explicit type mutation (which can work either by role mixin or by new object