Re: [perl #60732] Hash indexes shouldn't work on array refs

2008-11-24 Thread Moritz Lenz
jerry gay wrote: On Fri, Nov 21, 2008 at 10:43, via RT Moritz Lenz [EMAIL PROTECTED] wrote: # New Ticket Created by Moritz Lenz # Please include the string: [perl #60732] # in the subject line of all future correspondence about this issue. # URL:

Re: [perl #60732] Hash indexes shouldn't work on array refs

2008-11-24 Thread Rafael Garcia-Suarez
Moritz Lenz wrote in perl.perl6.compiler : jerry gay wrote: On Fri, Nov 21, 2008 at 10:43, via RT Moritz Lenz [EMAIL PROTECTED] wrote: # New Ticket Created by Moritz Lenz # Please include the string: [perl #60732] # in the subject line of all future correspondence about this issue. # URL:

Re: [perl #60732] Hash indexes shouldn't work on array refs

2008-11-24 Thread Patrick R. Michaud
On Fri, Nov 21, 2008 at 10:43:15AM -0800, Moritz Lenz wrote: From #perl6 today: 19:33 moritz_ rakudo: my $x = [ 42 ]; say $x0 19:33 p6eval rakudo 32984: OUTPUT[42␤] I don't think that should be allowed. It's allowed at least for Match objects -- from S05: # The numbered captures

Re: [perl #60732] Hash indexes shouldn't work on array refs

2008-11-24 Thread Jon Lang
On Mon, Nov 24, 2008 at 7:19 AM, Rafael Garcia-Suarez [EMAIL PROTECTED] wrote: Moritz Lenz wrote in perl.perl6.compiler : jerry gay wrote: On Fri, Nov 21, 2008 at 10:43, via RT Moritz Lenz [EMAIL PROTECTED] wrote: # New Ticket Created by Moritz Lenz # Please include the string: [perl

[perl #60732] Hash indexes shouldn't work on array refs

2008-11-21 Thread via RT
# New Ticket Created by Moritz Lenz # Please include the string: [perl #60732] # in the subject line of all future correspondence about this issue. # URL: http://rt.perl.org/rt3/Ticket/Display.html?id=60732 From #perl6 today: 19:33 moritz_ rakudo: my $x = [ 42 ]; say $x0 19:33 p6eval

Re: [perl #60732] Hash indexes shouldn't work on array refs

2008-11-21 Thread jerry gay
On Fri, Nov 21, 2008 at 10:43, via RT Moritz Lenz [EMAIL PROTECTED] wrote: # New Ticket Created by Moritz Lenz # Please include the string: [perl #60732] # in the subject line of all future correspondence about this issue. # URL: http://rt.perl.org/rt3/Ticket/Display.html?id=60732 From

Re: === and array-refs

2006-08-17 Thread David Green
On 8/16/06, David Green wrote: $a=[1, 2, [EMAIL PROTECTED]; $c=[1, 2, [EMAIL PROTECTED]; $d=[1, 2, [EMAIL PROTECTED]; $a =:= $c; #false, different variables $a === $c; #true, same elements make up $a and $c $a eqv $c; #true, same elements

Re: === and array-refs

2006-08-17 Thread Darren Duncan
At 11:16 PM -0600 8/16/06, David Green wrote: On 8/15/06, Darren Duncan wrote: At 2:51 PM -0600 8/15/06, David Green wrote: [...] You are right, but we have both Seq and Array types, so depending which one you use, you want either the === or eqv operators to do what you want. There is no

Re: === and array-refs

2006-08-17 Thread Markus Laire
On 8/17/06, Darren Duncan [EMAIL PROTECTED] wrote: Generally speaking, the direct use of === is more for specialized purposes, somewhat like the direct use of =:= is. If one can't tell the difference between === and eqv, they most likely want snapshot semantics anyway, and so might as well

Re: === and array-refs

2006-08-17 Thread David Green
On 8/17/06, Darren Duncan wrote: At 11:16 PM -0600 8/16/06, David Green wrote: I just want [1,2] to be === to [1,2], or [1,2, [EMAIL PROTECTED] to be equal to [1,2, [EMAIL PROTECTED] but !=== [1,2, [EMAIL PROTECTED] -- eqv won't work in the latter case (regardless of Seq vs. Array -- I didn't

Re: === and array-refs

2006-08-17 Thread David Green
On 8/16/06, David Green wrote: $a=[1, 2, [EMAIL PROTECTED]; $c=[1, 2, [EMAIL PROTECTED]; $d=[1, 2, [EMAIL PROTECTED]; $a =:= $c; #false, different variables $a === $c; #true, same elements make up $a and $c $a eqv $c; #true, same elements

Re: === and array-refs

2006-08-17 Thread Larry Wall
On Thu, Aug 17, 2006 at 12:18:55PM -0600, David Green wrote: : So perhaps what I'm looking for is more syntactic : sugar for easily traversing nested data : structures in different ways. Quoth S03: If that's not enough flexibility, there is also an Ceqv() function that can be passed

Re: === and array-refs

2006-08-17 Thread Mark J. Reed
On 8/17/06, David Green [EMAIL PROTECTED] wrote: $a=[1, 2, [EMAIL PROTECTED]; $c=[1, 2, [EMAIL PROTECTED]; $d=[1, 2, [EMAIL PROTECTED]; So $a, $c, and $d may all have the same *value* (or snapshot, when evaluated all the way down through nesting and references), i.e. they might be

Re: === and array-refs

2006-08-17 Thread Dave Whipp
David Green wrote: No, look at the example I've been using. Two arrays (1, 2, [EMAIL PROTECTED]) and (1, 2, [EMAIL PROTECTED]) clearly have different (unevaluated) contents. eqv only tells me whether they have the same value (when @x and @y are evaluated). That's a different question --

Re: === and array-refs

2006-08-17 Thread Andrew Suffield
On Thu, Aug 17, 2006 at 12:00:17AM -0700, Darren Duncan wrote: As a lead-in, I should say that Synopsis 3 has a good and complete explanation of these matters and has had it for several weeks, in my opinion. Since you are wanting to compare two mutable Array, just use the eqv operator,

Re: === and array-refs

2006-08-17 Thread Ben Morrow
Quoth [EMAIL PROTECTED] (Mark J. Reed): On 8/17/06, David Green [EMAIL PROTECTED] wrote: $a=[1, 2, [EMAIL PROTECTED]; $c=[1, 2, [EMAIL PROTECTED]; $d=[1, 2, [EMAIL PROTECTED]; So $a, $c, and $d may all have the same *value* (or snapshot, when evaluated all the way down

Re: === and array-refs

2006-08-17 Thread Audrey Tang
在 2006/8/18 上午 3:31 時,Ben Morrow 寫到: Just to make sure I've got all this straight: =:= compares names === compares containers eqv compares values =:= evaluates both sides as lvalue -- that's VAR() -- and compare them with ===. === evaluates both sides as rvalue and, for

Re: === and array-refs

2006-08-16 Thread Markus Laire
On 8/16/06, Darren Duncan [EMAIL PROTECTED] wrote: Both the === and eqv operators test the actual values of 2 containers, but that their semantics differ in regards to mutable containers. Given an immutable container/type, such as a number or Str or Seq, both will always return true if the

Re: === and array-refs

2006-08-16 Thread Darren Duncan
At 11:42 AM +0300 8/16/06, Markus Laire wrote: On 8/16/06, Darren Duncan [EMAIL PROTECTED] wrote: The difference between === and eqv is that, if you have 2 symbols, $a and $b, and $a === $b returns true, then that result is guaranteed to be eternal if you don't assign to either symbol

Re: === and array-refs

2006-08-16 Thread Dr.Ruud
Markus Laire schreef: my $x = 'Just Another'; my $y := $x; $y = 'Perl Hacker'; After this, both $x and $y contain the string Perl Hacker, since they are really just two different names for the same variable. /quote So $x === Sy stil holds. -- Affijn, Ruud Gewoon is een

Re: === and array-refs

2006-08-16 Thread Markus Laire
On 8/16/06, Dr.Ruud [EMAIL PROTECTED] wrote: Markus Laire schreef: my $x = 'Just Another'; my $y := $x; $y = 'Perl Hacker'; After this, both $x and $y contain the string Perl Hacker, since they are really just two different names for the same variable. /quote So $x === Sy

Re: === and array-refs

2006-08-16 Thread Charles Bailey
On 8/16/06, Darren Duncan [EMAIL PROTECTED] wrote: At 11:42 AM +0300 8/16/06, Markus Laire wrote: On 8/16/06, Darren Duncan [EMAIL PROTECTED] wrote: The difference between === and eqv is that, if you have 2 symbols, $a and $b, and $a === $b returns true, then that result is guaranteed to be

Re: === and array-refs

2006-08-16 Thread Markus Laire
On 8/16/06, Darren Duncan [EMAIL PROTECTED] wrote: I'll try saying what I meant differently here: The difference between === and eqv is that, if you have 2 symbols, $a and $b, and $a === $b returns true, then that result is guaranteed to be eternal if you don't assign to either symbol [or other

Re: === and array-refs

2006-08-16 Thread Dr.Ruud
Markus Laire schreef: Dr.Ruud: Markus Laire: my $x = 'Just Another'; my $y := $x; $y = 'Perl Hacker'; After this, both $x and $y contain the string Perl Hacker, since they are really just two different names for the same variable. /quote So $x === Sy stil[l] holds.

Re: === and array-refs

2006-08-16 Thread Larry Wall
On Wed, Aug 16, 2006 at 04:25:13PM +0200, Dr.Ruud wrote: : Comparing strings in Perl5, using NFKD: : : perl5 -MUnicode::Normalize -we ' : ($\, $,) = (\n, \t) ; : $x = qq{Henry IV} ; : $y = qq{Henry \x{2163}} ; : print qq{$x}, qq{$y}, length $x, length $y, $x eq $y ? 1 : 0 ; : # $x = NFKD

Re: === and array-refs

2006-08-16 Thread David Green
On 8/16/06, Dr.Ruud wrote: I also wondered why a simple array (for example containing only value type objects) whould not C=== its copy. But with .SKID that must be easy to handle. That's what I was wondering that started off this thread. I understand (more or less, I think), why it *does*

Re: === and array-refs

2006-08-16 Thread David Green
On 8/16/06, Charles Bailey wrote: This is where the eternal part starts to confuse me (not picking on your wording, but on the semantics). I'll pick on the wording (wording should always be picked on -- not to be pedantic (OK, I like to be pedantic, but that's not the *only* reason!), but

Re: === and array-refs

2006-08-16 Thread Dr.Ruud
Larry Wall schreef: Dr.Ruud: Comparing strings in Perl5, using NFKD: perl5 -MUnicode::Normalize -we ' ($\, $,) = (\n, \t) ; $x = qq{Henry IV} ; $y = qq{Henry \x{2163}} ; print qq{$x}, qq{$y}, length $x, length $y, $x eq $y ? 1 : 0 ; # $x = NFKD $x ; $y = NFKD $y ; print

Re: === and array-refs

2006-08-16 Thread David Green
is what makes sense to me, but S03 says [1,2]!===[1,2]. My position is that even if they are different objects, that difference is fairly useless, and should therefore be hidden (same as it is for objects that are strings). First of all, in Perl 6, there are no separate arrays and array refs

=== and array-refs

2006-08-15 Thread David Green
(or P4, etc.) thinks it's just one big array or list. Then when references were introduced, array-refs provided a way to encapsulate arrays so we could work with them as single lumps. It's not the most elegant solution, but being able to nest data structures at all was a tremendous benefit

Re: === and array-refs

2006-08-15 Thread Darren Duncan
, in Perl 6, there are no separate arrays and array refs; we simply have the 'Array' type, which is treated as a lump on its own. More generally, there are no reference types in Perl 6. We do have a concept of multiple symbols being aliases for the same container, and they only come