Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:20810 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85495 invoked by uid 1010); 29 Nov 2005 10:49:06 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 85480 invoked from network); 29 Nov 2005 10:49:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Nov 2005 10:49:06 -0000 X-Host-Fingerprint: 194.109.253.196 mediawave.xs4all.nl Received: from ([194.109.253.196:22367] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 84/2C-21657-1223C834 for ; Tue, 29 Nov 2005 05:49:05 -0500 Message-ID: <84.2C.21657.1223C834@pb1.pair.com> To: internals@lists.php.net Date: Tue, 29 Nov 2005 11:49:27 +0100 User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 References: <3A.B9.21657.F672C834@pb1.pair.com> In-Reply-To: <3A.B9.21657.F672C834@pb1.pair.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 194.109.253.196 Subject: Re: [PHP-DEV] Re: Labeled Breaks (not the G-word) From: bart@mediawave.nl (Bart de Boer) I agree. Although there's aanother thread running about namespaces that are about to do something with ':' as well. Watch out that there aren't conflicts? Ron Korving wrote: > 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"" schreef in bericht > news:CDA511FF6152D14E922434CE338CE8BB275842@leedsmet-exch1.leedsmet.ac.uk... > 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: 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