Re: Apoc4: The loop keyword

2002-01-28 Thread Steve Fink
On Sun, Jan 27, 2002 at 10:43:08PM -, Rafael Garcia-Suarez wrote: Melvin Smith wrote in perl6-language: Besides no one has commented on Steve Fink's (I think it was him) idea to store the result of the most recently executed conditional in $?. I kinda like that idea myself. It makes

Re: Apoc4: The loop keyword

2002-01-28 Thread Jonathan Scott Duff
On Mon, Jan 28, 2002 at 09:56:03AM -0800, Steve Fink wrote: Allowing $? would eliminate having any different behavior from boolean vs scalar context, and that seems like a potentially bad idea. (And I really don't like the idea of behavior changing based on the addition of a $? way down

Re: Apoc4: The loop keyword

2002-01-28 Thread Steve Fink
On Fri, Jan 25, 2002 at 11:31:13PM -0500, Melvin Smith wrote: At 11:40 AM 1/25/2002 -0600, Jonathan Scott Duff wrote: On Fri, Jan 25, 2002 at 11:57:25AM +0100, Bart Lateur wrote: On Mon, 21 Jan 2002 15:43:07 -0500, Damian Conway wrote: What we're cleaning up is the ickiness of having

Re: Apoc4: The loop keyword

2002-01-28 Thread Larry Wall
Buddha Buck writes: : We have : while (foo()) - $a {...} : doing the right thing. Well, Cfor does that currently, not Cwhile, but... : Why can't : : if foo() - $a { ... } : : take the place of the perl5 : : if (my $a = foo()) {...} I'd do something explicit like -$a before I'd do some

Re: Apoc4: The loop keyword

2002-01-27 Thread Rafael Garcia-Suarez
Melvin Smith wrote in perl6-language: Besides no one has commented on Steve Fink's (I think it was him) idea to store the result of the most recently executed conditional in $?. I kinda like that idea myself. It makes mnemonic sense. I like the $? idea, and it could probably be optimized

Re: Apoc4: The loop keyword

2002-01-26 Thread Richard J Cox
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Jonathan Scott Duff) wrote: On Fri, Jan 25, 2002 at 11:57:25AM +0100, Bart Lateur wrote: On Mon, 21 Jan 2002 15:43:07 -0500, Damian Conway wrote: What we're cleaning up is the ickiness of having things declared outside the braces be

Re: Apoc4: The loop keyword

2002-01-26 Thread Jonathan Scott Duff
On Fri, Jan 25, 2002 at 12:50:51PM -0800, Erik Steven Harrison wrote: Besides no one has commented on Steve Fink's (I think it was him) idea to store the result of the most recently executed conditional in $?. I kinda like that idea myself. It makes mnemonic sense. H . . . I could grow

Re: Apoc4: The loop keyword

2002-01-25 Thread Steve Fink
On Mon, Jan 21, 2002 at 12:50:38PM -0800, Larry Wall wrote: In most other languages, you wouldn't even have the opportunity to put a declaration into the conditional. You'd have to say something like: my $line = $in; if $line ne { ... } Since if my $line = $in { ... }

Re: Apoc4: The loop keyword

2002-01-25 Thread Bart Lateur
On Mon, 21 Jan 2002 15:43:07 -0500, Damian Conway wrote: What we're cleaning up is the ickiness of having things declared outside the braces be lexical to the braces. *That's* hard to explain to beginners. But it's handy. And that was, until now, what mattered with Perl. -- Bart.

Re: Apoc4: The loop keyword

2002-01-25 Thread Jonathan Scott Duff
On Fri, Jan 25, 2002 at 11:57:25AM +0100, Bart Lateur wrote: On Mon, 21 Jan 2002 15:43:07 -0500, Damian Conway wrote: What we're cleaning up is the ickiness of having things declared outside the braces be lexical to the braces. *That's* hard to explain to beginners. But it's handy. And

Re: Apoc4: The loop keyword

2002-01-25 Thread Buddha Buck
At 11:40 AM 01-25-2002 -0600, Jonathan Scott Duff you wrote: On Fri, Jan 25, 2002 at 11:57:25AM +0100, Bart Lateur wrote: On Mon, 21 Jan 2002 15:43:07 -0500, Damian Conway wrote: What we're cleaning up is the ickiness of having things declared outside the braces be lexical to the braces.

Re: Apoc4: The loop keyword

2002-01-25 Thread Erik Steven Harrison
Besides no one has commented on Steve Fink's (I think it was him) idea to store the result of the most recently executed conditional in $?. I kinda like that idea myself. It makes mnemonic sense. H . . . I could grow used to that. A couple of thoughts. 1) It doesn't seem to buy us much

Re: Apoc4: The loop keyword

2002-01-25 Thread Melvin Smith
At 11:40 AM 1/25/2002 -0600, Jonathan Scott Duff wrote: On Fri, Jan 25, 2002 at 11:57:25AM +0100, Bart Lateur wrote: On Mon, 21 Jan 2002 15:43:07 -0500, Damian Conway wrote: What we're cleaning up is the ickiness of having things declared outside the braces be lexical to the braces.

Re: Night of the Living Lexical (sequel to Apoc4: The loop keyword)

2002-01-22 Thread Piers Cawley
Michael G Schwern [EMAIL PROTECTED] writes: On Mon, Jan 21, 2002 at 03:02:06PM -0500, Tzadik Vanderhoof wrote: Why all the fuss? Often, you would *want* to access that lexical after the loop terminates, for instance to check how it terminated. In most cases you don't want that to happen,

Night of the Living Lexical (sequel to Apoc4: The loop keyword)

2002-01-21 Thread Melvin Smith
At 12:32 PM 1/21/2002 -0500, Michael G Schwern wrote: On Sun, Jan 20, 2002 at 10:58:34PM -0800, Larry Wall wrote: : while( my $line = FILE ) { : ... : } That still works fine--it's just that $line lives on after the while. This creeping lexical leakage bothers me.

RE: Night of the Living Lexical (sequel to Apoc4: The loop keyword)

2002-01-21 Thread Tzadik Vanderhoof
Conway; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: Night of the Living Lexical (sequel to Apoc4: The loop keyword) On Mon, Jan 21, 2002 at 02:44:40PM -0500, Melvin Smith wrote: At 12:32 PM 1/21/2002 -0500, Michael G Schwern wrote: On Sun, Jan 20, 2002 at 10:58:34PM -0800, Larry Wall wrote

Re: Apoc4: The loop keyword

2002-01-21 Thread Ted Ashton
Thus it was written in the epistle of Michael G Schwern, On Sun, Jan 20, 2002 at 10:58:34PM -0800, Larry Wall wrote: : while( my $line = FILE ) { : ... : } That still works fine--it's just that $line lives on after the while. This creeping lexical leakage bothers

Re: Apoc4: The loop keyword

2002-01-21 Thread Casey West
On Mon, Jan 21, 2002 at 03:26:30PM -0500, Ted Ashton wrote: : :Thus it was written in the epistle of Michael G Schwern, : On Sun, Jan 20, 2002 at 10:58:34PM -0800, Larry Wall wrote: : : while( my $line = FILE ) { : : ... : : } : : That still works fine--it's just that $line

Re: Apoc4: The loop keyword

2002-01-21 Thread Rafael Garcia-Suarez
On 2002.01.21 18:32 Michael G Schwern wrote: On Sun, Jan 20, 2002 at 10:58:34PM -0800, Larry Wall wrote: : while( my $line = FILE ) { : ... : } That still works fine--it's just that $line lives on after the while. This creeping lexical leakage bothers me. While it

Re: Apoc4: The loop keyword

2002-01-21 Thread Graham Barr
On Mon, Jan 21, 2002 at 12:50:38PM -0800, Larry Wall wrote: : What's the chance that it could be considered so? In most other languages, you wouldn't even have the opportunity to put a declaration into the conditional. You'd have to say something like: my $line = $in; if $line

Re: Apoc4: The loop keyword

2002-01-21 Thread Michael G Schwern
On Mon, Jan 21, 2002 at 03:27:29PM -0500, Casey West wrote: So you're suggesting that we fake lexical scoping? That sounds more icky than sticking to true lexical scoping. A block dictates scope, not before and not after. I don't see ickyness about making that so. Perl5 already fakes

Re: Apoc4: The loop keyword

2002-01-21 Thread Melvin Smith
At 12:50 PM 1/21/2002 -0800, Larry Wall wrote: In most other languages, you wouldn't even have the opportunity to put a declaration into the conditional. You'd have to say something like: I grudgingly agree here. Where did this shorthand come from anyway? The first time I ever used it was C++

Re: Apoc4: The loop keyword

2002-01-21 Thread Larry Wall
Michael G Schwern writes: : On Mon, Jan 21, 2002 at 03:27:29PM -0500, Casey West wrote: : So you're suggesting that we fake lexical scoping? That sounds more : icky than sticking to true lexical scoping. A block dictates scope, : not before and not after. I don't see ickyness about making

Re: Apoc4: The loop keyword

2002-01-21 Thread Graham Barr
On Mon, Jan 21, 2002 at 03:58:49PM -0500, Michael G Schwern wrote: On Mon, Jan 21, 2002 at 03:43:07PM -0500, Damian Conway wrote: Casey wrote: So you're suggesting that we fake lexical scoping? That sounds more icky than sticking to true lexical scoping. A block dictates scope,

Re: Apoc4: The loop keyword

2002-01-21 Thread Graham Barr
On Mon, Jan 21, 2002 at 01:01:09PM -0800, Larry Wall wrote: Graham Barr writes: : But are we not at risk of introducing another form of : : my $x if 0; : : with : : if my $one = ONE { : ... : } : elsif my $two = TWO { : } : : if ($two) { : ... : } Then

RE: Apoc4: The loop keyword

2002-01-21 Thread David Whipp
Graham Barr wrote: But I have lost count of the number of times I have wanted to do if ((my $foo = bar()) eq 'foo') { ... } if ($foo eq 'bar') { ... } To be contrasted with: while (my($k, $v) = each %h1) { ... } while (my($k, $v) = each %h2) # error? { ... }

Re: Night of the Living Lexical (sequel to Apoc4: The loop keyword)

2002-01-21 Thread Uri Guttman
MS == Melvin Smith [EMAIL PROTECTED] writes: MS At 12:32 PM 1/21/2002 -0500, Michael G Schwern wrote: On Sun, Jan 20, 2002 at 10:58:34PM -0800, Larry Wall wrote: : while( my $line = FILE ) { : ... : } That still works fine--it's just that $line lives on

Re: Night of the Living Lexical (sequel to Apoc4: The loop keyword)

2002-01-21 Thread Melvin Smith
At 04:12 PM 1/21/2002 -0500, Uri Guttman wrote: MS lives on, ... creeping lexical, I feel the same way, we must find some MS way to kill these... :) well, larry looks at it differently and what he said on the cruise makes Well we had a go, but our kung fu powers were no match for

Re: Apoc4: The loop keyword

2002-01-21 Thread Larry Wall
Graham Barr writes: : On Mon, Jan 21, 2002 at 01:01:09PM -0800, Larry Wall wrote: : Graham Barr writes: : : But are we not at risk of introducing another form of : : : : my $x if 0; : : : : with : : : : if my $one = ONE { : : ... : : } : : elsif my $two = TWO { : : }

Re: Apoc4: The loop keyword

2002-01-21 Thread Glenn Linderman
Michael G Schwern wrote: In this case I'll take long-term simplicity over short-term easy-to-explain rules. Otherwise we'll be writing this all over the place til Kingdom come. do { if my $foo = bar() { ... } } I'm surprised no one else has

Re: Apoc4: The loop keyword

2002-01-21 Thread Graham Barr
On Mon, Jan 21, 2002 at 01:38:39PM -0800, Larry Wall wrote: Graham Barr writes: : On Mon, Jan 21, 2002 at 01:01:09PM -0800, Larry Wall wrote: : Graham Barr writes: : : But are we not at risk of introducing another form of : : : : my $x if 0; : : : : with : : : : if my

Re: Apoc4: The loop keyword

2002-01-20 Thread Damian Conway
Bryan C. Warnock wrote: No examples are given, but are we to assume that this: for ($x = 0; $x 100; $x++) { ... } becomes this: loop $x=0; $x 100; $x++ { ... } Yes. How would you use an $x lexically scoped to the loop block? You

Re: Apoc4: The loop keyword

2002-01-20 Thread Larry Wall
Damian Conway writes: : Bryan C. Warnock wrote: : : No examples are given, but are we to assume that this: : : for ($x = 0; $x 100; $x++) { : ... : } : : becomes this: : : loop $x=0; $x 100; $x++ { : ... : } : : Yes. : : : How would you use

Re: Apoc4: The loop keyword

2002-01-20 Thread Michael G Schwern
On Sun, Jan 20, 2002 at 07:25:17PM -0500, Damian Conway wrote: How would you use an $x lexically scoped to the loop block? You can't...directly. Nor can a Cwhile or Cif. The new rule is that to be lexical to a block it has to be declared in the block, or in the block's parameter list.

Re: Apoc4: The loop keyword

2002-01-20 Thread Larry Wall
Michael G Schwern writes: : On Sun, Jan 20, 2002 at 07:25:17PM -0500, Damian Conway wrote: : How would you use an $x lexically scoped to the loop block? : : You can't...directly. Nor can a Cwhile or Cif. The new rule is that : to be lexical to a block it has to be declared in the block, or

Apoc4: The loop keyword

2002-01-19 Thread Bryan C. Warnock
No examples are given, but are we to assume that this: for ($x = 0; $x 100; $x++) { ... } becomes this: loop $x=0; $x 100; $x++ { ... } How would you use an $x lexically scoped to the loop block? Most of the other constructs seem to be using a '- $x'