# GOTO and/or BREAK LABEL

- Thread: https://externals.io/message/22247
- Original archive: https://news-web.php.net/php.internals/22247
- Started by Ford on 2006-03-08T14:12:20+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #22247 — Ford — 2006-03-08T14:12:20+00:00

URL: https://externals.io/message/22247#22247

> 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: m.ford@leedsmet.ac.uk
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

---

## #22265 — Xuefer — 2006-03-09T03:19:17+00:00

URL: https://externals.io/message/22247#22265 · In reply to: #22247

> 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 (...) {...}
a. label: for (....) { break label; }  AND  label: { for (....) {
break label; } } (see
http://www.rgagnon.com/javadetails/java-0500.html )
b. for (....) label { break label; }
c. for (....) { break label; } label:
ok, i was +1 for c, but +1 for b now.

only use "Java-like" syntax if "goto" will never be implemented

---

## #22266 — Steph Fox — 2006-03-09T04:48:28+00:00

URL: https://externals.io/message/22247#22266 · In reply to: #22265

Please, Xuefer!  Your vote was already recorded, shhh!

----- Original Message ----- 
From: "Xuefer" <xuefer@gmail.com>
To: "Ford, Mike" <M.Ford@leedsmet.ac.uk>
Cc: "Dmitry Stogov" <dmitry@zend.com>; <internals@lists.php.net>
Sent: Thursday, March 09, 2006 5:19 AM
Subject: Re: [PHP-DEV] GOTO and/or BREAK LABEL


> > […]
> a. label: for (....) { break label; }  AND  label: { for (....) {
> break label; } } (see
> http://www.rgagnon.com/javadetails/java-0500.html )
> b. for (....) label { break label; }
> c. for (....) { break label; } label:
> ok, i was +1 for c, but +1 for b now.
>
> only use "Java-like" syntax if "goto" will never be implemented

---

## #22315 — Xuefer — 2006-03-10T03:06:13+00:00

URL: https://externals.io/message/22247#22315 · In reply to: #22266

> Please, Xuefer!  Your vote was already recorded, shhh!
i wasn't to vote more than once. it's same vote but with a bit
different syntax changed. oh well, the result is out, this is only my
explaination.
