I agree. Like you I couldn't really care about a 'goto', I'd probably never 
use it. But labeled breaks would really add something to the language. The 
current break counters aren't very user friendly if you ask me.

I'm very much in favor of:

LABEL: while (cond)
{
  ...
  break LABEL;
  ...
}

I've seen it being mentioned that the 'LABEL' would be appended to the while 
loop, something like this:

while (cond)
{
  ...
  break LABEL;
  ...
}
LABEL:

But I think that's absolutely hideous and looks like a 'goto' (which is most 
likely why people began talking about adding 'goto' in the first place). If 
it were up to me (and it's not), 'goto' will not be implemented in any form 
and the break keyword can refer to numbers and labels and in case of the 
latter, these would be PREpended to the loop construct.

Ron



""Ford, Mike"" <[EMAIL PROTECTED]> schreef in bericht 
news:[EMAIL PROTECTED]
I'm completely indifferent about goto (in any form), but *PLEASE* can we 
have labelled break/continue -- something like:

  LABEL: while (cond):
    ...
    break LABEL;
    ...
  endwhile;

or

  while LABEL (cond):
    ...
    break LABEL;
    ...
  endwhile;

or

  while (cond) LABEL:
    ...
    break LABEL;
    ...
  endwhile;

I can't tell you the number of times I've broken my own code by adding or 
removing an inner loop and failing to notice that a break/continue count 
needs incrementing/decrementing.  Labelled breaks are a relatively simple 
addition to the syntax that would improve the programming experience out of 
all proportion.  Yes it's complete syntactic sugar -- it doesn't do anything 
you can't currently do, just does it in a much more friendly way -- but 
incredibly helpful sugar ;)

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm 

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to