Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl loops should use break, not last

Reply
Thread Tools

Perl loops should use break, not last

 
 
Jeremy Morton
Guest
Posts: n/a
 
      01-29-2005
Probably been mentioned before but I fail to see why Perl changed the
'break' keyword to 'last', in loops. Bear with me on this - it seems
semantically more accurate to say 'break' - you're immediately breaking out
of the loop. 'last' makes it sound like the current loop will be the last,
but not that the execution should be stopped immediately, whereas break
makes it sound like the latter.

Where can I propose that this be changed, or break aliased to last, for Perl
6?


--
Best regards,
Jeremy Morton (Jez)


 
Reply With Quote
 
 
 
 
Big and Blue
Guest
Posts: n/a
 
      01-30-2005
Jeremy Morton wrote:
> Bear with me on this - it seems
> semantically more accurate to say 'break' - you're immediately breaking out
> of the loop. 'last' makes it sound like the current loop will be the last,


The semantics of 'break' or 'last' are defined by the language (in this
case Perl), not by you.

Why not think of 'last' as "this is the last statement to run for the
loop".

It's always struck me as odd that the 'continue' statement in 'C'
starts the next pass of a loop. This is definitely a strange use of the
concept of "continue". But it is the semantics of 'C', so I accept it.
By trying to map particular programming concepts into single English words
with exisiting meaning there is always going to be some sort of mismatching
oddity.


--
Just because I've written it doesn't mean that
either you or I have to believe it.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
while-loops enter the last time after condition is filled? skanemupp@yahoo.se Python 4 04-07-2008 12:08 PM
skip last line in loops eight02645999@yahoo.com Python 15 12-18-2006 08:42 PM
Loops with loops using html-template Me Perl Misc 2 01-12-2006 05:07 PM
Perl loops should use break, not last Jeremy Morton Perl Misc 34 01-31-2005 10:39 PM
MS Perl question -- how to use hacked script to work correctly(was Question on loops and return values or sumpin) James Perl Misc 12 12-20-2004 04:15 PM



Advertisments