Re: Apoc4: The loop keyword

2002-01-28 Thread Larry Wall
Buddha Buck writes: : We have : while (foo()) -> $a {...} : doing the right thing. Well, C does that currently, not C, 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 implicit

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

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 wi

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.

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 optim

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 c

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 > > >t

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 bra

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 muc

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 th

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.

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 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 = <$

Re: Apoc4: The loop keyword

2002-01-22 Thread Piers Cawley
Michael G Schwern <[EMAIL PROTECTED]> 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 ick

RE: Apoc4: The loop keyword

2002-01-21 Thread Michael Percy
Graham Barr wrote: > On Mon, Jan 21, 2002 at 03:58:49PM -0500, Michael G Schwern wrote: Case 1: > > do { > > if my $foo = bar() { > > ... > > } > > } Case 2: > if ((my $foo = bar()) eq 'foo') { > ... > } > > if ($foo eq 'bar') { > ... > } Des

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 > : > : >

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 h

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 = { : > : ... : > : } : > : elsif my $two = { : > :

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: Apoc4: The loop keyword

2002-01-21 Thread Larry Wall
Michael G Schwern writes: : In this case I'll take long-term simplicity over short-term : easy-to-explain rules. I fail to see what's simpler about it. : Otherwise we'll be writing this all over the : place til Kingdom come. : : do { : if my $foo = bar() { : ... :

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 = { > : ... > : } > : elsif my $two = { > : } > : > : if ($two) { > : ... > :

Re: Apoc4: The loop keyword

2002-01-21 Thread Larry Wall
Graham Barr writes: : But are we not at risk of introducing another form of : : my $x if 0; : : with : : if my $one = { : ... : } : elsif my $two = { : } : : if ($two) { : ... : } Then it's just undefined. It's no different from how &&, ||, or ??:: work when you put a

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 s

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 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 Michael G Schwern
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, > > not before and not after. I don't see ickyness about making that s

Re: Apoc4: The loop keyword

2002-01-21 Thread Larry Wall
David Whipp writes: : 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. : : Perl is well known for its non-or

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 l

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>; >

Re: Apoc4: The loop keyword

2002-01-21 Thread Larry Wall
Ted Ashton writes: : 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 = ) { : > > : ... : > > : } : > > : > > That still works fine--it's just that $line lives on after the while. : >

RE: Apoc4: The loop keyword

2002-01-21 Thread David Whipp
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. Perl is well known for its non-orthogonality. To say that "A bloc

Re: Apoc4: The loop keyword

2002-01-21 Thread Damian Conway
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, > not before and not after. I don't see ickyness about making that so. Exactly! What we're cleaning up is the ickiness of having things dec

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 = ) { > > : ... > > : } > > > > That still works fine--it's just that $line lives on after the while. > > This creeping lexical leakage bothers me. W

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 = ) { :> > : ... :> > : } :> > :> > That still works fine--it's just that

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 = ) { > > : ... > > : } > > > > That still works fine--it's just that $line lives on after the while. > > This creeping lexical leakage bo

Re: Apoc4: The loop keyword

2002-01-21 Thread Michael G Schwern
On Sun, Jan 20, 2002 at 10:58:34PM -0800, Larry Wall wrote: > : while( my $line = ) { > : ... > : } > > That still works fine--it's just that $line lives on after the while. This creeping lexical leakage bothers me. While it might make the language simpler, the proliferation of

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 C or C. The new rule is that : > to be lexical to a block it has to be declared in the block, or in

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 C or C. 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. > > Y

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

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?