Re: identity tests and comparing two references [PATCH for S06 and A06]

2005-04-17 Thread Patrick R. Michaud
On Tue, Apr 12, 2005 at 06:22:13PM +0200, Thomas Sandlaß wrote: > > I've edited the above syntax into S06 and A06. The two patches > are attached but I don't know if you are the right one to sent > them to. Whom should I sent such patches? I just saw you applying > other patches as well. Applied,

Re: identity tests and comparing two references

2005-04-07 Thread Thomas Sandlaß
Larry Wall wrote: : Is a closure return type indicated with this siglet syntax, too? : : sub foo :(Str,Int) of :(Any) {...} You would need :() only to group multiple siglets into a single type. So an Any can stand on its own. Ohh, interessting! I wanted to express a return value type that is a su

Re: identity tests and comparing two references

2005-04-07 Thread Thomas Sandlaß
Austin Hastings wrote: So if $$ref gives the 'all the way down' behavior, how do I get "just one layer down" dereferencing? How about: my XMLnode $x = parseXML( "file.xml" ); do_something( $x.down.down.down.item[17].up.up.body.down.down ); Details of class XMLnode and friends left as an excercise

Re: identity tests and comparing two references

2005-04-06 Thread Larry Wall
On Wed, Apr 06, 2005 at 02:43:55PM -0500, Patrick R. Michaud wrote: : On Wed, Apr 06, 2005, Larry Wall wrote: : > I think it's time to break out : > the colon again and use something like: : > : > &infix:<+>:(Complex, Complex); : > : > or : > : > &foo:(Str,Int) : > : > for ordinary fun

Re: identity tests and comparing two references

2005-04-06 Thread Aaron Sherman
On Wed, 2005-04-06 at 14:37, Larry Wall wrote: > On Wed, Apr 06, 2005 at 08:24:23PM +0200, Juerd wrote: > : Larry Wall skribis 2005-04-06 11:10 (-0700): > : > $$ref follow the ref list to the actual object. > : > : my $foo; > : my $bar = \$foo; > : my $quux = \$bar; > : my $xyz

Re: identity tests and comparing two references

2005-04-06 Thread Juerd
Larry Wall skribis 2005-04-06 11:37 (-0700): > : my $foo; > : my $bar = \$foo; > : my $quux = \$bar; > : my $xyzzy = \$quux; > : How then, with only $xyzzy, do you get $bar? $$xyzzy would follow until > : $foo. I don't like this at all. > You can't get at $bar anyway. You can only

Re: identity tests and comparing two references

2005-04-06 Thread Patrick R. Michaud
On Wed, Apr 06, 2005, Larry Wall wrote: > I think it's time to break out > the colon again and use something like: > > &infix:<+>:(Complex, Complex); > > or > > &foo:(Str,Int) > > for ordinary functions. If it gets really popular people might > even start writing: > > sub foo :(S

Re: identity tests and comparing two references

2005-04-06 Thread Austin Hastings
Larry Wall wrote: On Wed, Apr 06, 2005 at 08:24:23PM +0200, Juerd wrote: : Larry Wall skribis 2005-04-06 11:10 (-0700): : > $$ref follow the ref list to the actual object. : : my $foo; : my $bar = \$foo; : my $quux = \$bar; : my $xyzzy = \$quux; : : How then, with only $xyzzy,

Re: identity tests and comparing two references

2005-04-06 Thread John Macdonald
On Wed, Apr 06, 2005 at 11:30:35AM -0700, Larry Wall wrote: > If you want to help, earn a billion dollars and write me into your > will. And then peg out. Nothing personal. :-) > > Larry Darn. So far, I'm, 0 for 3 on that plan. However, I promise that item two will follow very shortly in tim

Re: identity tests and comparing two references

2005-04-06 Thread Larry Wall
On Wed, Apr 06, 2005 at 08:24:23PM +0200, Juerd wrote: : Larry Wall skribis 2005-04-06 11:10 (-0700): : > $$ref follow the ref list to the actual object. : : my $foo; : my $bar = \$foo; : my $quux = \$bar; : my $xyzzy = \$quux; : : How then, with only $xyzzy, do you get $bar

Re: identity tests and comparing two references

2005-04-06 Thread Larry Wall
On Wed, Apr 06, 2005 at 07:22:48PM +0200, Thomas Sandlaß wrote: : HaloO Larry, : : you wrote: : >for ordinary functions. If it gets really popular people might : >even start writing: : > : >sub foo :(Str,Int) {...} : : I like it, but that could mean it will not become popular :)) : And this

Re: identity tests and comparing two references

2005-04-06 Thread Juerd
Larry Wall skribis 2005-04-06 11:10 (-0700): > $$ref follow the ref list to the actual object. my $foo; my $bar = \$foo; my $quux = \$bar; my $xyzzy = \$quux; How then, with only $xyzzy, do you get $bar? $$xyzzy would follow until $foo. I don't like this at all. > $ref.fo

Re: identity tests and comparing two references

2005-04-06 Thread Larry Wall
On Mon, Apr 04, 2005 at 06:50:11PM +0200, Thomas Sandlaß wrote: : Juerd wrote: : >And will Perl 6 reference values rather than their containers, that is: : >will \$foo differ when $foo gets a new value, just as in Python id(foo) : >changes after foo += 1? : : Depends on the definition of the seman

Re: identity tests and comparing two references

2005-04-06 Thread Thomas Sandlaß
HaloO Larry, you wrote: for ordinary functions. If it gets really popular people might even start writing: sub foo :(Str,Int) {...} I like it, but that could mean it will not become popular :)) And this is also nice: sub foo :(Str,Int) of Str {...} Is a closure return type indicated with this

Re: identity tests and comparing two references

2005-04-06 Thread Larry Wall
On Wed, Apr 06, 2005 at 10:07:33AM -0600, Luke Palmer wrote: : Thomas Sandlaß writes: : > Larry Wall wrote: : > >Yes. It should complain that = is not a valid type signature. : > >Any &foo (or &foo:<...>) followed by <...> should be parsed as a single : > >term selecting the function that MMD woul

Re: identity tests and comparing two references

2005-04-06 Thread Larry Wall
On Wed, Apr 06, 2005 at 04:31:08PM +0200, Thomas Sandlaß wrote: : Larry Wall wrote: : >Yes. It should complain that = is not a valid type signature. : >Any &foo (or &foo:<...>) followed by <...> should be parsed as a single : >term selecting the function that MMD would dispatch to given that : >ty

Re: identity tests and comparing two references

2005-04-06 Thread Luke Palmer
Thomas Sandlaà writes: > Larry Wall wrote: > >Yes. It should complain that = is not a valid type signature. > >Any &foo (or &foo:<...>) followed by <...> should be parsed as a single > >term selecting the function that MMD would dispatch to given that > >type signature. > > And I guess it's not a

Re: identity tests and comparing two references

2005-04-06 Thread Thomas Sandlaß
Larry Wall wrote: Yes. It should complain that = is not a valid type signature. Any &foo (or &foo:<...>) followed by <...> should be parsed as a single term selecting the function that MMD would dispatch to given that type signature. And I guess it's not allowed to have interspersed whitespace unl

Re: identity tests and comparing two references

2005-04-05 Thread Larry Wall
On Tue, Apr 05, 2005 at 06:38:43PM +0200, Thomas Sandlaß wrote: : Ups, a missing : warps this to a completly different meaning! : Comparing a coderef &infix with the comparison operator <=> : to the word list 'Scalar of Ref of Ref of Int,Int'. : : I tried to ask what &infix:<=> : does. This is the

Re: identity tests and comparing two references

2005-04-05 Thread Thomas Sandlaß
Juerd wrote: Thomas Sandlaß skribis 2005-04-04 18:50 (+0200): In particular what does &infix<=> do? Depends. What does it mean? :) Specifically, what is &infix, what is <=>? Ups, a missing : warps this to a completly different meaning! Comparing a coderef &infix with the comparison operator <=> to

Re: identity tests and comparing two references

2005-04-04 Thread Juerd
Thomas Sandlaß skribis 2005-04-04 18:50 (+0200): > In particular what does &infix<=> do? Depends. What does it mean? :) Specifically, what is &infix, what is <=>? > 'Scalar of Ref of Any' without dispatching to 'Ref of Int'. That means References and aliasing should have nothing to do with type

Re: identity tests and comparing two references

2005-04-04 Thread Thomas Sandlaß
Juerd wrote: my $four := three; Assuming you meant $three instead of three. Indeed. Sorry. my $five = 5; $four = 4; # $one == 4 now? No, $four (and thus $three, which it is bound to) is now 4. $three is a reference, which is a value, which is now *replaced* with the new value. OK. Then you need to

Re: identity tests and comparing two references

2005-04-02 Thread Larry Wall
On Sat, Apr 02, 2005 at 11:22:43AM +0200, Leopold Toetsch wrote: : Larry Wall <[EMAIL PROTECTED]> wrote: : >: On Thu, 2005-03-31 at 23:46 -0800, Darren Duncan wrote: : >: : >: In P6, an object is a data-type. It's not a reference, and any member : >: payload is attached directly to the variable. :

Re: identity tests and comparing two references

2005-04-02 Thread Larry Wall
On Sat, Apr 02, 2005 at 11:06:01AM +0200, Juerd wrote: : Is your view of the world like Python or like Perl 5? Them's fightin' words. :-) : Values have no identity in Perl 5. That's slightly not true, insofar as Perl 5 distinguishes hash keys by value (albeit filtered through stringification).

Re: identity tests and comparing two references

2005-04-02 Thread Leopold Toetsch
Larry Wall <[EMAIL PROTECTED]> wrote: >: On Thu, 2005-03-31 at 23:46 -0800, Darren Duncan wrote: >: >: In P6, an object is a data-type. It's not a reference, and any member >: payload is attached directly to the variable. > Well, it's still a reference, but we try to smudge the distinction in P6.

Re: identity tests and comparing two references

2005-04-02 Thread Juerd
James Mastros skribis 2005-04-01 22:48 (+0200): > $x = 42; > $a = \$x but false; > $b = \$y but blue; > $a =:= $b ??? Even without the buts, that is: $x = 42; $a = \$x; $b = \$x; I strongly believe that $a =:= $b must be false. Assignment copies! $a =:= $b should be true only if $a a

Re: identity tests and comparing two references

2005-04-02 Thread Juerd
Thomas Sandlaß skribis 2005-04-02 1:17 (+0200): > my $one = 1; > my $two := $one; > my $three = \$two; # same as := ? was actually your question, or not? No, that was not my question. I deliberately used binding and assignment, for there to be an important difference, which I think =:= should re

Re: identity tests and comparing two references

2005-04-01 Thread Thomas Sandlaß
James Mastros wrote: $x = 42; $a = \$x but false; $b = \$y but blue; Assuming you meant \$x in the last row we are dealing with three values: 42 but true 42 but false 42 but blue Which are not identical but equal. The first value is not necessarily implemented that way because the boolean value can

Re: identity tests and comparing two references

2005-04-01 Thread James Mastros
Larry Wall wrote: On Fri, Apr 01, 2005 at 08:39:52AM -0700, Luke Palmer wrote: : I'm pretty sure that =:= does what you want. If you have two scalar : references, you might have to spell it like this: : : $$x =:= $$y Unnecessary, I think. I want $x =:= @y to tell me whether the referenc

Re: identity tests and comparing two references

2005-04-01 Thread Thomas Sandlaß
HaloO Juerd, you wrote: Thomas Sandlaß skribis 2005-04-01 23:37 (+0200): So you expect $bar to contain value 2 and detach from $foo? No. But if you said $baz instead of $bar, then yes. Ohh sorry, I mis-read your mail as talking about chains of references: $baz to $bar to $foo to 2. The last step co

Re: identity tests and comparing two references

2005-04-01 Thread Juerd
Thomas Sandlaß skribis 2005-04-01 23:37 (+0200): > Juerd wrote (with substitution applied): > >IMO, =:= should not auto(de)reference. > So you expect $bar to contain value 2 and detach from $foo? No. But if you said $baz instead of $bar, then yes. > How would one then reach the value in $foo? Wit

Re: identity tests and comparing two references

2005-04-01 Thread Thomas Sandlaß
Juerd wrote (with substitution applied): IMO, =:= should not auto(de)reference. So you expect $bar to contain value 2 and detach from $foo? How would one then reach the value in $foo? With $$baz? And for longer chains of referene with a corresponding number of $ on the front? But IIRC that was obvi

Re: identity tests and comparing two references

2005-04-01 Thread Juerd
Juerd skribis 2005-04-01 22:35 (+0200): > $foo :=: $bar; # true > $foo :=: $baz; # also true?! > IMO, :=: should not auto(de)reference. s:g/:=:/=:=/ Juerd -- http://convolution.nl/maak_juerd_blij.html http://convolution.nl/make_juerd_happy.html http://convolution.nl/gajigu_juerd_n.ht

Re: identity tests and comparing two references

2005-04-01 Thread Juerd
Larry Wall skribis 2005-04-01 7:47 (-0800): > : $$x =:= $$y > Unnecessary, I think. I want > $x =:= @y > to tell me whether the reference in $x is to the same array as @y. But my $foo; my $bar := $foo; my $baz = \$foo; $foo :=: $bar; # true $foo :=: $baz; # also t

Re: identity tests and comparing two references

2005-04-01 Thread Darren Duncan
At 7:37 AM -0800 4/1/05, Larry Wall wrote: On Thu, Mar 31, 2005 at 11:46:22PM -0800, Darren Duncan wrote: : So, what is the operator for reference comparison? The =:= operator is almost certainly what you want here. Larry Thanks to everyone for their answers. Last night I started coding with =:=

Re: identity tests and comparing two references

2005-04-01 Thread Aaron Sherman
On Fri, 2005-04-01 at 10:46, Larry Wall wrote: > On Fri, Apr 01, 2005 at 08:04:22AM -0500, Aaron Sherman wrote: > : In P6, an object is a data-type. It's not a reference, and any member > : payload is attached directly to the variable. > > Well, it's still a reference, but we try to smudge the di

Re: identity tests and comparing two references

2005-04-01 Thread Larry Wall
On Fri, Apr 01, 2005 at 08:39:52AM -0700, Luke Palmer wrote: : I'm pretty sure that =:= does what you want. If you have two scalar : references, you might have to spell it like this: : : $$x =:= $$y Unnecessary, I think. I want $x =:= @y to tell me whether the reference in $x is to th

Re: identity tests and comparing two references

2005-04-01 Thread Larry Wall
: On Thu, 2005-03-31 at 23:46 -0800, Darren Duncan wrote: On Fri, Apr 01, 2005 at 08:04:22AM -0500, Aaron Sherman wrote: : : > What I want to be able to do is compare two references to see if they : > point to the same thing, in this case an object, but in other cases : > perhaps some other type

Re: identity tests and comparing two references

2005-04-01 Thread Luke Palmer
Sam Vilain writes: > Darren Duncan wrote: > >Now I seem to remember reading somewhere that '===' will do what I want, > >but I'm now having trouble finding any mention of it. > >So, what is the operator for reference comparison? > > As someone who wrote a tool that uses refaddr() and 0+ in Perl 5

Re: identity tests and comparing two references

2005-04-01 Thread Larry Wall
On Thu, Mar 31, 2005 at 11:46:22PM -0800, Darren Duncan wrote: : So, what is the operator for reference comparison? The =:= operator is almost certainly what you want here. Larry

Re: identity tests and comparing two references

2005-04-01 Thread Aaron Sherman
On Thu, 2005-03-31 at 23:46 -0800, Darren Duncan wrote: > What I want to be able to do is compare two references to see if they > point to the same thing, in this case an object, but in other cases > perhaps some other type of thing. Let's be clear about the difference between P5 and P6 here. I

Re: identity tests and comparing two references

2005-03-31 Thread Sam Vilain
Darren Duncan wrote: Now I seem to remember reading somewhere that '===' will do what I want, but I'm now having trouble finding any mention of it. So, what is the operator for reference comparison? As someone who wrote a tool that uses refaddr() and 0+ in Perl 5 to achieve the same thing, I agre

identity tests and comparing two references

2005-03-31 Thread Darren Duncan
As I continue porting code to Perl 6, I found something else that the synopsis don't seem to explain clearly. What I want to be able to do is compare two references to see if they point to the same thing, in this case an object, but in other cases perhaps some other type of thing. In synopsis