RE: [PHP-DEV] GOTO and/or BREAK LABEL

From: Date: Wed, 08 Mar 2006 14:12:20 +0000
Subject: RE: [PHP-DEV] GOTO and/or BREAK LABEL
Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On 07 March 2006 09:28, Dmitry Stogov wrote:

> Please reviw and vote.
> 
> 1) goto and break label
> 2) goto only (like C)
> 3) break label only (like Java)
> 4) nothing

1) +0.25
2) -1e38
3) +1e38
4) -infinity

Or, in other words, I want labelled break, and I don't want to have to emulate it with goto.

As a user who spent several *days* tracking down a subtle bug caused by a continue n that
hadn't been altered to continue n+1, I regard labelled break as a vital addition -- for me,
it's not the frequency with which it is used (very low, I agree), but the incredibly
disproportionate maintenance burden (potentially extremely high).  In my case, I was adding a level
to a heavily nested looping/conditional structure (7 or 8 levels deep) extending over several
hundred lines, and out of the few break/continue statements that needed adjusting I missed just one.
 If they had been labelled breaks, there would have been *no* maintenance problem, and I'd have
had several more days on the next step.

If the "Java-like" syntax is seen as confusing, what about, as in some other languages,
interpolating the label into the for/foreach/while statement:

   for (....) label {...}  or  for label (...) {...}

This is clearly a different animal from a goto target label: (but should be in the same namespace,
of course).

OK, I'll shut up now and slope off into a corner.  (Perhaps I should design my own language
whilst I'm there ... but nah, did that decades ago and got bored -- prefer higher-level
programming these days!)

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


Thread (106 messages)

« previous php.internals (#22247) next »