Re: Paren madness (was Re: Regex query)

2002-10-01 Thread Thomas A. Boyer
David Whipp wrote: $b = 7, 6, 5 b = 7, 6, 5 I understand that C's *interpretation* of the comma operator will be expunged from Perl 6. But unless comma's *precedence* is also changing, neither of those statements would build a list with three elements. It seems to me that $b = 7, 6,

Re: Regex query

2002-09-29 Thread Smylers
Aaron Sherman wrote: On Sat, 2002-09-21 at 06:38, Smylers wrote: ... lists now use square brackets. I don't disagree that this is a good thing, but let's look at some cases that might not look the way you had intended: Snip Oh, I hadn't really intending anything. Starting from what

Re: Regex query

2002-09-29 Thread Smylers
Luke Palmer wrote: On 21 Sep 2002, Smylers wrote: But because C$num _might_ be used as an array ref, the data has to be kept around, which is wasteful. The programmer should know whether it would or wouldn't, Oh, I wasn't doubting that. I was just concerned that if the 'typical' way

Re: Regex query

2002-09-24 Thread Aaron Sherman
On Tue, 2002-09-24 at 01:46, Trey Harris wrote: In a message dated 24 Sep 2002, Aaron Sherman writes: This is because push is almost certainly defined as: sub push(@target, *@list) { ... } That should be sub push(@target is rw, *@list); Well, yes, but that wasn't the

Re: Regex query

2002-09-24 Thread Simon Cozens
[EMAIL PROTECTED] (Aaron Sherman) writes: say that array refs behave the same as arrays in every way *except* as pertains to list flattening, and in that case, explicit flattening is required, otherwise the ref is kept in the flattened array. Another blow to regularity. :( --

Re: Regex query

2002-09-24 Thread Simon Cozens
[EMAIL PROTECTED] (Aaron Sherman) writes: If we have to resort to much magic to get these right, we're pretty much doomed from the outset. You have that upside-down. Because this is so fundamental, it's worth a great deal of magic to make it seem right in as many contexts as possible.

Re: Regex query

2002-09-24 Thread Jonathan Scott Duff
On Tue, Sep 24, 2002 at 11:30:57AM +0100, Simon Cozens wrote: At any rate, I do wish we'd stop kidding ourselves that Perl 6 is at all going to be cleaned up or regular; I bet it'll end up with more edge cases and special exceptions than Perl 5. Simon, Perl 6 *will* be more regular as long as

Re: Regex query

2002-09-24 Thread Peter Haworth
On 24 Sep 2002 05:21:37 -0400, Aaron Sherman wrote: On Tue, 2002-09-24 at 01:46, Trey Harris wrote: sub push(@target is rw, *@list); Well, yes, but that wasn't the point. The C*@list will force array flattening, thus push @a, [1,2,3], 4; will (according to Larry's stated

Re: Regex query

2002-09-24 Thread Chip Salzenberg
According to Trey Harris: According to Larry, $a = (1,2,3); is equivalent to $a = [1,2,3]; because they're both equivalent to $a = scalar(1,2,3) But that's the bit we're arguing about. If you allow $a = (1,2) then what about $a = (1) ? And if someone says that I have to

Re: Regex query

2002-09-24 Thread Trey Harris
In a message dated Tue, 24 Sep 2002, Chip Salzenberg writes: According to Trey Harris: According to Larry, $a = (1,2,3); is equivalent to $a = [1,2,3]; because they're both equivalent to $a = scalar(1,2,3) But that's the bit we're arguing about. If you allow $a = (1,2)

Re: Regex query

2002-09-24 Thread Aaron Sherman
On Tue, 2002-09-24 at 10:27, Peter Haworth wrote: On 24 Sep 2002 05:21:37 -0400, Aaron Sherman wrote: On Tue, 2002-09-24 at 01:46, Trey Harris wrote: sub push(@target is rw, *@list); Well, yes, but that wasn't the point. The C*@list will force array flattening, thus push

Re: Regex query

2002-09-24 Thread Dan Sugalski
At 11:07 AM -0400 9/24/02, Trey Harris wrote: *shrug* Regardless of whether we like it, what Larry said is true unless and until he invokes Rule 2. And unless he invokes Rule 2, Cscalar(1,2,3) is equivalent to C[1,2,3]. Then perhaps, rather than fretting over the unpleasant consequences of

Re: Regex query

2002-09-24 Thread Aaron Sherman
On Tue, 2002-09-24 at 11:07, Trey Harris wrote: In a message dated Tue, 24 Sep 2002, Chip Salzenberg writes: then what about $a = (1) ? And if someone says that I have to write: $a = (1,) then I am going on the warpath. That Way Lay Python. I would *never* suggest

Re: Regex query

2002-09-24 Thread Trey Harris
In a message dated 24 Sep 2002, Aaron Sherman writes: That doesn't really work. Because now you introduce the case where: $x = (1,2,3); y = (1,2,3); $z = [1,2,3]; push a, $x, y, $z, (1,2,3), [1,2,3]; Behaves in ways that will take hours to explain to newbies, and I

Re: Regex query

2002-09-24 Thread Trey Harris
In a message dated Tue, 24 Sep 2002, Jonathan Scott Duff writes: On Tue, Sep 24, 2002 at 11:14:04AM -0400, Aaron Sherman wrote: Again, we're wading into the waters of over-simplification. Let's try: sub foo1(){ my foo=(1,2,3); return foo; } sub foo2(){ my $foo = [1,2,3];

Re: Regex query

2002-09-24 Thread Jonathan Scott Duff
On Tue, Sep 24, 2002 at 12:14:10PM -0400, Trey Harris wrote: In a message dated Tue, 24 Sep 2002, Jonathan Scott Duff writes: On Tue, Sep 24, 2002 at 11:14:04AM -0400, Aaron Sherman wrote: Again, we're wading into the waters of over-simplification. Let's try: sub foo1(){ my

Re: Regex query

2002-09-24 Thread John Williams
In a message dated Tue, 24 Sep 2002, Chip Salzenberg writes: then what about $a = (1) ? And if someone says that I have to write: $a = (1,) then I am going on the warpath. That Way Lay Python. You _can_ write that, but you don't _have_ to. [1], (1),

RE: Paren madness (was Re: Regex query)

2002-09-24 Thread David Whipp
It seems that the fundamental problem is the dichotomy between a scalar, and a list of 1 elem. Thus, we want $a = 7 to DWIM, whether I mean a list, or a scalar. Seems to me that the best way to solve a dichotomy is to declare it to not to be one: a scalar *IS* a list of one element. The only

Re: Paren madness (was Re: Regex query)

2002-09-24 Thread Jonathan Scott Duff
On Tue, Sep 24, 2002 at 11:47:16AM -0700, David Whipp wrote: It seems that the fundamental problem is the dichotomy between a scalar, and a list of 1 elem. Thus, we want $a = 7 to DWIM, whether I mean a list, or a scalar. Seems to me that the best way to solve a dichotomy is to declare

RE: Paren madness (was Re: Regex query)

2002-09-24 Thread Aaron Sherman
On Tue, 2002-09-24 at 14:47, David Whipp wrote: It seems that the fundamental problem is the dichotomy between a scalar, and a list of 1 elem. Thus, we want After the first couple of messages, that was really no longer *my* concern, but I can't speak for others. My concern was mostly that

Re: Paren madness (was Re: Regex query)

2002-09-24 Thread Mike Lambert
2. Scalar assignment. my $a;# 1. $a = X; my $a;# 3. ($a) = X; These should all do the same thing, regardless of X. Consider: $a = (1); and ($a) = (1); 5. Assignment to arrays and lists. $a = (1, 2, 3); # Same as Perl 5's $a = [1,2,3]; $a = (1)

Re: Paren madness (was Re: Regex query)

2002-09-24 Thread Trey Harris
In a message dated Tue, 24 Sep 2002, Mike Lambert writes: Consider: $a = (1); and ($a) = (1); Yes? They both do the same thing--set $a to 1. It looks like the bottom one is a list assigned to a list, but that might be optimized out, as it doesn't matter. 5. Assignment to arrays and

RE: Paren madness (was Re: Regex query)

2002-09-24 Thread David Whipp
From: Jonathan Scott Duff $b = 7, 6, 5 b = 7, 6, 5 Again, both create identical objects, under different interfaces. But now we have a problem with +$b: what should this mean? To be consistant with +$a (above), I would suggest that it simply returns the sum of its elements

Re: Paren madness (was Re: Regex query)

2002-09-24 Thread John Williams
On Tue, 24 Sep 2002, Mike Lambert wrote: $a = (1, 2, 3); # Same as Perl 5's $a = [1,2,3]; $a = (1) should then do $a = [1], according to the above. This implies that: ($a) = (1) implies that $a is [1], something I don't particularly agree with. You may be missing the change in the

Re: Regex query

2002-09-23 Thread Andrew Rodland
On Sat, 21 Sep 2002 16:33:31 -0600 (MDT), Luke Palmer said: You know, the idea that square brackets are the only things that can make lists is starting to really appeal to me. Similar for squiggles and hashes. I don't know how many times in my early Perl5 days I did this: Since we now

Re: Regex query

2002-09-23 Thread Simon Cozens
[EMAIL PROTECTED] (Luke Palmer) writes: Since we now have an explicit flattening operator (unary *), there's no need to differentiate between a real list and a reference to one. What context does push impute on its operands? If push @a, [1,2,3,4]; and push @a, 1,2,3,4; are going to

Re: Regex query

2002-09-23 Thread Aaron Sherman
On Sat, 2002-09-21 at 06:38, Smylers wrote: So if the difference between lists with parens and anon arrays with square brackets is going away, it may make sense to standardize on the latter rather than the former. In other words, lists now use square brackets. That frees up parens for

Re: Regex query

2002-09-23 Thread Luke Palmer
On 23 Sep 2002, Simon Cozens wrote: [EMAIL PROTECTED] (Luke Palmer) writes: Since we now have an explicit flattening operator (unary *), there's no need to differentiate between a real list and a reference to one. What context does push impute on its operands? If push @a,

Paren madness (was Re: Regex query)

2002-09-23 Thread Trey Harris
I think this discussion has gotten out of hand, and I hope that Larry, Damian or Allison will grace us with a resolution soon. :-) May I suggest that we start with some DWIMmy examples and try to arrive at a mechanism that will make them all DWIM? Here are my opinions, feel free to shoot them

Re: Regex query

2002-09-23 Thread Simon Cozens
[EMAIL PROTECTED] (Luke Palmer) writes: push @a: [1,2,3,4]; pushes an array ref onto @a. push @a: *[1,2,3,4]; pushes 1, 2, 3, and 4 onto @a (as it would without the * and []). Remind me which language this is supposed to be, again? -- Life sucks, but it's better than the

Re: Paren madness (was Re: Regex query)

2002-09-23 Thread Simon Cozens
[EMAIL PROTECTED] (Trey Harris) writes: May I suggest that we start with some DWIMmy examples Sam sat on the ground and put his head in his hands. 'I wish I had never come here, and I don't want to see no more magic,' he said, and fell silent. -- I hooked up my accelerator pedal in my car to

Re: Paren madness (was Re: Regex query)

2002-09-23 Thread Luke Palmer
On Mon, 23 Sep 2002, Jonathan Scott Duff wrote: On Mon, Sep 23, 2002 at 04:58:55PM -0400, Trey Harris wrote: for (1,(a,b,c),3 { ... } and for 1,(a,b,c),3 { ... } Now that I've ventured away from DWIMs and more into WIHDTEMs (What In Hell Does This Expression Mean), is the

Re: Regex query

2002-09-23 Thread Luke Palmer
On 24 Sep 2002, Simon Cozens wrote: [EMAIL PROTECTED] (Luke Palmer) writes: push @a: [1,2,3,4]; pushes an array ref onto @a. push @a: *[1,2,3,4]; pushes 1, 2, 3, and 4 onto @a (as it would without the * and []). Remind me which language this is supposed to be, again?

Re: Paren madness (was Re: Regex query)

2002-09-23 Thread Trey Harris
In a message dated Mon, 23 Sep 2002, Luke Palmer writes: Y'all have it backwards. [1,*[2,[3,4,5]],6] # [1,2,[3,4,5],6] [1,*[2,*[3,4,5]],6] # [1,2,3,4,5,6] Flat flattens outwards, not inwards. Ah. *slaps head* of course. That makes much more sense.

Re: Paren madness (was Re: Regex query)

2002-09-23 Thread Aaron Sherman
On Mon, 2002-09-23 at 16:58, Trey Harris wrote: 4. Numeric value. The progression spoken about at great length previously: +()# == 0 +(0) # == WHAT? 0? 1? +(0,1) # == 2 +(0,1,2) # == 3 +(0,1,2,3) # == 4 +(0,...,n) # == n + 1 is largely

Re: Regex query

2002-09-23 Thread Aaron Sherman
On Mon, 2002-09-23 at 15:48, Luke Palmer wrote: On 23 Sep 2002, Simon Cozens wrote: [EMAIL PROTECTED] (Luke Palmer) writes: Since we now have an explicit flattening operator (unary *), there's no need to differentiate between a real list and a reference to one. What context does

Re: Paren madness (was Re: Regex query)

2002-09-23 Thread Trey Harris
Replying to myself to clear a few things up... In a message dated Mon, 23 Sep 2002, Trey Harris writes: 2. Scalar assignment. my $a;# 1. $a = X; my $a;# 2. $a = X; my $a;# 3. ($a) = X; my($a) = X; # 4. my($a) = (X); # 5.

Re: Regex query

2002-09-23 Thread Trey Harris
In a message dated 24 Sep 2002, Aaron Sherman writes: Grrr... I want that to work, really I do, but since, as Larry has pointed out, there's no functional difference between an array ref and an array in Perl 6, they would be the same. This is because push is almost certainly defined as:

Re: Regex query

2002-09-23 Thread Aaron Sherman
On Sat, 2002-09-21 at 06:18, Smylers wrote: $num = @massive; C$num becomes a reference to C@massive, but in a numeric context it will evaluate to the number of elements in that array. But in most cases, you would never do this. You would do something like my int $num =

Re: Regex query

2002-09-23 Thread Trey Harris
In a message dated 24 Sep 2002, Aaron Sherman writes: This is because push is almost certainly defined as: sub push(target, *@list) { ... } That should be sub push(target is rw, *@list); but otherwise I think that's right. Now, implementation in Perl 6 (though I assume it's

Re: Paren madness (was Re: Regex query)

2002-09-23 Thread John Williams
On Mon, 23 Sep 2002, Trey Harris wrote: So then, I think if there's just some clarification about how one-tuples are formed, I think everything I wrote in my earlier mail can DWIM correctly. There seems to be no magic here, quotations from LoTR to the contrary. :-) Your post was very

Re: Regex query

2002-09-23 Thread Aaron Sherman
On Sun, 2002-09-22 at 08:07, Simon Cozens wrote: [EMAIL PROTECTED] (Jonathan Scott Duff) writes: Why can't perl be smart enough to figure out what we mean? We're talking about lists, the second most fundamental data structure in the language. If we have to resort to much magic to get

Re: Regex query

2002-09-22 Thread Simon Cozens
[EMAIL PROTECTED] (Jonathan Scott Duff) writes: Why can't perl be smart enough to figure out what we mean? We're talking about lists, the second most fundamental data structure in the language. If we have to resort to much magic to get these right, we're pretty much doomed from the outset. --

Re: Regex query

2002-09-22 Thread Simon Cozens
[EMAIL PROTECTED] (Smylers) writes: Does that matter? This example is fairly contrived, and anybody actually concerned about this can always use: $num = @massive.length; I'd be in favour of forcing people to say this if they want the length of the array. But then, it might be that what

Re: Regex query

2002-09-22 Thread Pixel
Chip Salzenberg [EMAIL PROTECTED] writes: According to David Whipp: (7,8,9) == 3 # true (7,8) == 2 # true (7) == 1 # false () == 0 # true? Hell, yes, why didn't I think of that? This is exactly the same problem that afflicts Python's tuple syntax! various 1-uple

Re: Regex query

2002-09-22 Thread Dan Sugalski
At 10:52 AM -0500 9/21/02, Jonathan Scott Duff wrote: So, you expect 7.pow(2) to work? I'd expect it to be an error (this isn't python after all). Sure, why not? I mean, we already use methods on integers all the time--what do you thin 12.5 is anyway, other than calling the 5 method on the

Re: Regex query

2002-09-22 Thread Simon Cozens
[EMAIL PROTECTED] (Markus Laire) writes: How do you do C ($a + $b) * $c if parentheses are forbidden for mathematical expressions? I thought that , was actually the list constructor, much as = is the pair constructor. (And hence a = 1, b = 2 would be a list of pairs.) Of course,

Re: Regex query

2002-09-22 Thread John Williams
On Sat, 21 Sep 2002, Jonathan Scott Duff wrote: Why can't perl be smart enough to figure out what we mean? Something along these lines: (7) # list context (3+4) # numeric context (there's a numeric operator in there) (3+4,5) # list context (comma trumps the numeric

Re: Regex query

2002-09-22 Thread Chip Salzenberg
According to John Williams: On Sat, 21 Sep 2002, Jonathan Scott Duff wrote: (7,) is an abomination. It's one of python's misfeatures that annoys me the most. Of course, _requiring_ the comma is bad [...] Well, I don't know about Jonathan, but requiring the comma is exactly what Python

Re: Regex query

2002-09-21 Thread Smylers
Luke Palmer wrote: my v = $( func() ); Would provide scalar context. But then assign it to a list... In the course of reading that I developed a concern about memory usage when trying to find the size of arrays. As I understand it the Perl 5 syntax for discovering the number of

Re: Regex query

2002-09-21 Thread Smylers
Tanton Gibbs wrote: (7) == 7 why? Otherwise, we couldn't use parens for mathematical expressions Evil But as Luke Palmer pointed about above, this syntax would make square brackets redundant, so we could now use those unambiguously for overriding mathematical precedence ... /Evil (Sorry

Re: Regex query

2002-09-21 Thread Jonathan Scott Duff
On Fri, Sep 20, 2002 at 09:46:58PM -0600, John Williams wrote: On Fri, 20 Sep 2002, Jonathan Scott Duff wrote: But I cannot tell whether (7) is list context or numeric context, Nope, you can't tell without the surrounding context: (7) + 0;# numeric $a = (7); #

Re: Regex query

2002-09-21 Thread John Williams
On Sat, 21 Sep 2002, Jonathan Scott Duff wrote: I can't tell whether (7).length is asking for the length of 7 or the length of a list, but I would be badly surprised if (3+4).pow(2) returned 1 instead of 49. So, you expect 7.pow(2) to work? I'd expect it to be an error (this isn't

Re: Regex query

2002-09-21 Thread Jonathan Scott Duff
On Sat, Sep 21, 2002 at 11:36:49AM -0600, John Williams wrote: On Sat, 21 Sep 2002, Jonathan Scott Duff wrote: I can't tell whether (7).length is asking for the length of 7 or the length of a list, but I would be badly surprised if (3+4).pow(2) returned 1 instead of 49. So, you

Re: Regex query

2002-09-21 Thread Luke Palmer
On 21 Sep 2002, Smylers wrote: Luke Palmer wrote: my v = $( func() ); Would provide scalar context. But then assign it to a list... In the course of reading that I developed a concern about memory usage when trying to find the size of arrays. As I understand it the Perl 5

Re: Regex query

2002-09-21 Thread Markus Laire
On Sat, Sep 21, 2002 at 11:36:49AM -0600, John Williams wrote: On Sat, 21 Sep 2002, Jonathan Scott Duff wrote: Anyway, (7) or (3+4) should yield a number, not a list, because otherwise every math expression will break. Why can't perl be smart enough to figure out what we mean?

Re: Regex query

2002-09-21 Thread Luke Palmer
On Sun, 22 Sep 2002, Markus Laire wrote: On Sat, Sep 21, 2002 at 11:36:49AM -0600, John Williams wrote: On Sat, 21 Sep 2002, Jonathan Scott Duff wrote: Anyway, (7) or (3+4) should yield a number, not a list, because otherwise every math expression will break. Why can't perl

Re: Regex query

2002-09-21 Thread matt diephouse
Luke Palmer wrote: On Sun, 22 Sep 2002, Markus Laire wrote: You know, the idea that square brackets are the only things that can make lists is starting to really appeal to me. Similar for squiggles and snip So parens really do provide grouping, not list constructing. Thus, this can stay:

Re: Regex query

2002-09-20 Thread Uri Guttman
SC == Simon Cozens [EMAIL PROTECTED] writes: SC raiddev /dev/md0 SC raid-level 5 SC option value SC option value SC ... SC device /dev/sde1 SC raid-disk 0 i have some

Re: Regex query

2002-09-20 Thread Uri Guttman
SC == Simon Cozens [EMAIL PROTECTED] writes: SC rule comm_eol { sp* comment? sp* \n }; aren't those sp*'s redundant? the first is overlapping with the one at the beginning of comment. SC But comment only matches if there *is* a comment, and there may not SC be, so I want to

Re: Regex query

2002-09-20 Thread Simon Cozens
[EMAIL PROTECTED] (Uri Guttman) writes: actually i just had another thought. you don't need any of the $foo := stuff as the match tree will have it all for you. Yes, but it's nice to be able to access the captured things by name. Or should I be saying things like rule raiddev { comment*

Re: Regex query

2002-09-20 Thread Uri Guttman
SC == Simon Cozens [EMAIL PROTECTED] writes: SC [EMAIL PROTECTED] (Uri Guttman) writes: actually i just had another thought. you don't need any of the $foo := stuff as the match tree will have it all for you. SC Yes, but it's nice to be able to access the captured things by SC

Re: Regex query

2002-09-20 Thread Larry Wall
On 20 Sep 2002, Simon Cozens wrote: : their names. also if you use a scalar to grab something which is in a : quantified outer rule what is put in the var? a ref to a list of the : grabbed things? : : *nod* Something I'd like to know. Yes, in fact any list forced into scalar context will

Re: Regex query

2002-09-20 Thread Aaron Sherman
On Fri, 2002-09-20 at 04:14, Larry Wall wrote: On 20 Sep 2002, Simon Cozens wrote: : their names. also if you use a scalar to grab something which is in a : quantified outer rule what is put in the var? a ref to a list of the : grabbed things? : : *nod* Something I'd like to know.

Re: Regex query

2002-09-20 Thread Larry Wall
On 20 Sep 2002, Aaron Sherman wrote: : Is that any list as oppopsed to any array? Or is that arrayref in a : numeric context the length of the array? In other words does this do : what I think I think it does? : : $shouldbe3 = (1,2,3) + 0; It's 3, though not for the reason a Perl 5

Re: Regex query

2002-09-20 Thread Aaron Sherman
On Fri, 2002-09-20 at 10:39, Larry Wall wrote: On 20 Sep 2002, Aaron Sherman wrote: : Is that any list as oppopsed to any array? Or is that arrayref in a : numeric context the length of the array? In other words does this do : what I think I think it does? : : $shouldbe3 = (1,2,3) + 0;

Re: Regex query

2002-09-20 Thread John Williams
On Fri, 20 Sep 2002, Larry Wall wrote: Yes, in fact any list forced into scalar context will make a ref in Perl 6: $arrayref = (1,2,3); That would seem to obviate the need for brackets to define array references. Is there any case where [1,2,3] would be needed instead of (1,2,3)? Also,

Re: Regex query

2002-09-20 Thread Larry Wall
On Fri, 20 Sep 2002, John Williams wrote: : On Fri, 20 Sep 2002, Larry Wall wrote: : : Yes, in fact any list forced into scalar context will make a ref in Perl 6: : : $arrayref = (1,2,3); : : That would seem to obviate the need for brackets to define array : references. Is there any

Re: Regex query

2002-09-20 Thread John Williams
On Fri, 20 Sep 2002, Larry Wall wrote: On Fri, 20 Sep 2002, John Williams wrote: : On Fri, 20 Sep 2002, Larry Wall wrote: : : Yes, in fact any list forced into scalar context will make a ref in Perl 6: : : $arrayref = (1,2,3); : : That would seem to obviate the need for brackets

Re: Regex query

2002-09-20 Thread matt diephouse
John Williams wrote: On Fri, 20 Sep 2002, Larry Wall wrote: On Fri, 20 Sep 2002, John Williams wrote: : On Fri, 20 Sep 2002, Larry Wall wrote: : : Yes, in fact any list forced into scalar context will make a ref in Perl 6: : : $arrayref = (1,2,3); : : That would seem to obviate the

Re: Regex query

2002-09-20 Thread Luke Palmer
I was just thinking that $((1,2,3)) is also the same as [1,2,3], and shorter than scalar(1,2,3). I wonder if you can't just use $(1, 2, 3) to the same effect. I think you can. I was under the impression that the C comma was dying, so that would have to make a list or err. Also, I

Re: Regex query

2002-09-20 Thread Chip Salzenberg
According to Luke Palmer: I think to get Perl5 behavioueaur :), you do this: my @flatL = ( *(1a, 2a), *(1b, 2b) ); Geez, I hope not, because that would imply that in my @v = ( func() ); that func is called in a scalar context. -- Chip Salzenberg - a.k.a. -[EMAIL

RE: Regex query

2002-09-20 Thread David Whipp
Larry wrote: : $shouldbe3 = (1,2,3) + 0; It's 3, though not for the reason a Perl 5 programmer would think. (In Perl 6 it's the length of the anonymous array, not the last value.) This kind of clever magic always makes me nervous: it introduces subtle bug potentials. (7,8,9) == 3 #

Re: Regex query

2002-09-20 Thread Chip Salzenberg
According to David Whipp: (7,8,9) == 3 # true (7,8) == 2 # true (7) == 1 # false () == 0 # true? Hell, yes, why didn't I think of that? This is exactly the same problem that afflicts Python's tuple syntax! Larry, I strongly suggest that making () act in any way like []

Re: Regex query

2002-09-20 Thread Luke Palmer
On Fri, 20 Sep 2002, Chip Salzenberg wrote: According to Luke Palmer: I think to get Perl5 behavioueaur :), you do this: my flatL = ( *(1a, 2a), *(1b, 2b) ); Geez, I hope not, because that would imply that in my v = ( func() ); that func is called in a scalar context.

RE: Regex query

2002-09-20 Thread John Williams
On Fri, 20 Sep 2002, David Whipp wrote: Larry wrote: : $shouldbe3 = (1,2,3) + 0; It's 3, though not for the reason a Perl 5 programmer would think. (In Perl 6 it's the length of the anonymous array, not the last value.) This kind of clever magic always makes me nervous: it

Re: Regex query

2002-09-20 Thread Tanton Gibbs
This kind of clever magic always makes me nervous: it introduces subtle bug potentials. (7,8,9) == 3 # true (7,8) == 2 # true (7) == 1 # false () == 0 # true? I believe the last two cases should be: (7,)== 1 (,) == 0 Because its the perl6

Re: Regex query

2002-09-20 Thread Chip Salzenberg
According to John Williams: I believe the last two cases should be: (7,)== 1 (,) == 0 Gack! It's Python's tuple syntax! Run away! Run away! Seriously, having actually programmed Python for money (no smiley -- it was NOT fun), I can say that this syntactical hack would be a

Re: Regex query

2002-09-20 Thread Jonathan Scott Duff
On Fri, Sep 20, 2002 at 09:02:52PM -0600, John Williams wrote: On Fri, 20 Sep 2002, Tanton Gibbs wrote: If this is the case, then can you also have: (,7) What is its length? Hmm, it's a syntax error in perl5. I'd advocate it continuing to be a syntax error in perl 6. Maybe ()

Re: Regex query

2002-09-20 Thread Jonathan Scott Duff
On Fri, Sep 20, 2002 at 02:17:42PM -0700, David Whipp wrote: Larry wrote: : $shouldbe3 = (1,2,3) + 0; It's 3, though not for the reason a Perl 5 programmer would think. (In Perl 6 it's the length of the anonymous array, not the last value.) This kind of clever magic always makes

Re: Regex query

2002-09-20 Thread Tanton Gibbs
This kind of clever magic always makes me nervous: it introduces subtle bug potentials. (7,8,9) == 3 # true (7,8) == 2 # true (7) == 1 # false Why is this one false? I'd expect it to be true just as the others. (7) == 7 why? Otherwise, we couldn't use parens for

Re: Regex query

2002-09-20 Thread John Williams
On Fri, 20 Sep 2002, Jonathan Scott Duff wrote: But I cannot tell whether (7) is list context or numeric context, Nope, you can't tell without the surrounding context: (7) + 0;# numeric $a = (7); # list (7) == 1; # boolean (same as (7).length == 1)