Re: Loop controls

2002-04-26 Thread Allison Randal
On Fri, Apr 26, 2002 at 11:14:36PM -0600, Luke Palmer wrote: > On Fri, 26 Apr 2002, Allison Randal wrote: > > > Besides, I would expect an C to actually be a loop of it's own, > > on the principle of "elsif = else + if" so "elsfor = else + for". > > So, you're suggesting we add C then? Just bec

Re: Loop controls

2002-04-26 Thread Luke Palmer
On Fri, 26 Apr 2002, Allison Randal wrote: > Besides, I would expect an C to actually be a loop of it's own, > on the principle of "elsif = else + if" so "elsfor = else + for". So, you're suggesting we add C then? Just because it's possible doesn't mean it's necessary. Luke

Re: Loop controls

2002-04-26 Thread Miko O'Sullivan
> Of course it brings other less wholesome things to mind like "elsfor" > and "elsloop" and "if ... elsfor" and "for ... elsif ... elsloop ... > else", but why not? Well, I agree with the concept, but boyoboy those names ain't gonna fly. We'll have to head down the road of unlessfor

Re: Loop controls

2002-04-26 Thread Allison Randal
On Fri, Apr 26, 2002 at 05:24:13PM -0400, Aaron Sherman wrote: > On Fri, 2002-04-26 at 14:11, Allison Randal wrote: > > The "else" of a loop construct isn't really the same as the "else" of an > > C. You can't use an C for one thing. > > Why not? What would be wrong with: > > for @x { >

Re: Loop controls

2002-04-26 Thread Aaron Sherman
On Fri, 2002-04-26 at 14:11, Allison Randal wrote: > On Fri, Apr 26, 2002 at 08:49:23AM +1000, Damian Conway wrote: > Hmmm... how about: > > for $results.get_next() { > print $_; > LAST { print "Done."; } > ELSE { print "No results."; } > } > > The "else" of a loop construct isn't really

Re: Please rename 'but' to 'has'.

2002-04-26 Thread Pixel
Larry Wall <[EMAIL PROTECTED]> writes: > : Why not use a 16 bit int and specify that languages should use > : default precedence levels spread through the range but keeping the > : bottom 8 bits all zero. That gives 255 levels between '3' and '4'. > : Seems like enough to me! > : > : Floating po

Re: Please rename 'but' to 'has'.

2002-04-26 Thread Miko O'Sullivan
> This is now extensible to any number of precedence levels, and you can > now use simple string comparison to compare any two precedences. It even > short circuits the comparison as soon as it finds a character that > differs. > > Gee, maybe I should patent this. Too late. Amazon has already p

Re: Loop controls

2002-04-26 Thread Allison Randal
On Fri, Apr 26, 2002 at 08:49:23AM +1000, Damian Conway wrote: > Trey Harris wrote: > > > So: > > > > for $results.get_next() { > > FIRST { print "Results:"; } > > NEXT { print ""; } > > } else { > > print "No results."; > > } > > > > Do I have that right? > > Yes. Presuming Larry decide

Re: Please rename 'but' to 'has'.

2002-04-26 Thread Larry Wall
Buddha Buck writes: : So you'd have something like: : : sub operator:mult($a, $b) is looser('*') is inline {...} : sub operator:add($a, $b) is tighter("+") is inline {...} : sub operator:div($a,$b) is looser("/") is inline {...} : : assuming default Perl5 precedences for *, *, and / you would ha

Re: Please rename 'but' to 'has'.

2002-04-26 Thread Buddha Buck
At 09:45 AM 04-26-2002 -0700, Larry Wall wrote: >Tim Bunce writes: >: For perl at least I thought Larry has said that you'll be able to >: create new ops but only give them the same precedence as any one >: of the existing ops. > >Close, but not quite. What I think I said was that you can't speci

Re: Please rename 'but' to 'has'.

2002-04-26 Thread Larry Wall
Tim Bunce writes: : For perl at least I thought Larry has said that you'll be able to : create new ops but only give them the same precedence as any one : of the existing ops. Close, but not quite. What I think I said was that you can't specify a raw precedence--you can only specify a precedence

Re: Please rename 'but' to 'has'.

2002-04-26 Thread Dan Sugalski
At 5:05 PM +0100 4/26/02, Tim Bunce wrote: >On Fri, Apr 26, 2002 at 11:33:06AM -0400, Dan Sugalski wrote: >> At 2:26 PM +0100 4/26/02, Nicholas Clark wrote: >> >On Tue, Apr 23, 2002 at 01:25:15PM -0400, Dan Sugalski wrote: >> >> At 12:36 PM -0400 4/23/02, Buddha Buck wrote: >> >> >OK, but th

Re: Please rename 'but' to 'has'.

2002-04-26 Thread Tim Bunce
On Fri, Apr 26, 2002 at 11:33:06AM -0400, Dan Sugalski wrote: > At 2:26 PM +0100 4/26/02, Nicholas Clark wrote: > >On Tue, Apr 23, 2002 at 01:25:15PM -0400, Dan Sugalski wrote: > >> At 12:36 PM -0400 4/23/02, Buddha Buck wrote: > >> >OK, but that limits you to the, um, 24 standard levels of > >>

Re: Please rename 'but' to 'has'.

2002-04-26 Thread Dan Sugalski
At 2:26 PM +0100 4/26/02, Nicholas Clark wrote: >On Tue, Apr 23, 2002 at 01:25:15PM -0400, Dan Sugalski wrote: >> At 12:36 PM -0400 4/23/02, Buddha Buck wrote: >> >OK, but that limits you to the, um, 24 standard levels of >> >precedence. What do you do if you don't think that that's enough >>

Re: Loop controls

2002-04-26 Thread Tim Bunce
On Fri, Apr 26, 2002 at 10:29:58AM -0400, Aaron Sherman wrote: > On Thu, 2002-04-25 at 18:20, Damian Conway wrote: > > Miko O'Sullivan wrote: > > > > before { ... } # run before first iteration, > > > # only if there is at least one iteration > > > > Larry is still con

Re: Loop controls

2002-04-26 Thread Aaron Sherman
On Thu, 2002-04-25 at 18:20, Damian Conway wrote: > Miko O'Sullivan wrote: > > before { ... } # run before first iteration, > > # only if there is at least one iteration > > Larry is still considering allowing a C block that would do this. [...] > This will be called a

Re: Loop controls

2002-04-26 Thread Tatsuhiko Miyagawa
At Fri, 26 Apr 2002 09:40:14 +0100, Andy Wardley wrote: > This is an approach I've used to great effect in the Template Toolkit. > In this case, the iterator controlling a 'FOREACH' loop is aliased to > the 'loop' variable > >[% FOREACH x = y %] > [% "\n" IF loop.first %] > >

Re: Loop controls

2002-04-26 Thread Andy Wardley
On Fri, Apr 26, 2002 at 08:49:23AM +1000, Damian Conway wrote: > for $results.get_next() { > FIRST { print "Results:"; } > NEXT { print ""; } > LAST { print "Done."; } > print $_; > } How about something like this: for $results.each() { print