471,832 Members | 1,554 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,832 software developers and data experts.

Perl loops should use break, not last

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)
Jul 19 '05 #1
1 120002
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.
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Oleg Leschov | last post: by
46 posts views Thread by Reinhold Birkenfeld | last post: by
2 posts views Thread by bobmct | last post: by
6 posts views Thread by Wijaya Edward | last post: by
15 posts views Thread by eight02645999 | last post: by
crystal2005
4 posts views Thread by crystal2005 | last post: by
reply views Thread by YellowAndGreen | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.