On 29 November 2005 09:18, Bart de Boer wrote:
> I feel we're comparing apples with oranges here.
>
> Break; is for breaking out of loops. It shouldn't have anything to do
> with jumping to somewhere else. Let's say *if* PHP supported jumping
> through the code. The following should then be two different things:
>
> while (loop) {
> goto LABEL;
> }
> > LABEL
>
> while (loop) {
> break;
> }
>
> I think the question here is if we want to implement jumping
> through the
> code or not. If we do jumping in the code, this should be a
> full-fledged feature. If not, there should be no jumping. And it
> should, in my opinion, certainly not change the way break; works.
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