Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:20890 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 9069 invoked by uid 1010); 30 Nov 2005 09:45:31 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 9054 invoked from network); 30 Nov 2005 09:45:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Nov 2005 09:45:31 -0000 X-Host-Fingerprint: 194.109.253.196 mediawave.xs4all.nl Received: from ([194.109.253.196:14112] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 6D/77-14828-BB47D834 for ; Wed, 30 Nov 2005 04:45:31 -0500 Message-ID: <6D.77.14828.BB47D834@pb1.pair.com> To: internals@lists.php.net Date: Wed, 30 Nov 2005 10:45:48 +0100 User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 References: <2B.E1.14828.4130D834@pb1.pair.com> <1B.E4.14828.2DF6D834@pb1.pair.com> In-Reply-To: <1B.E4.14828.2DF6D834@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: Labeled Break (nothing at all whatsoever to do with GOTO) From: bart@mediawave.nl (Bart de Boer) I wasn't thinking about goto or break. I was thinking about *labels* and using them in a consistent manner with PHP. For example: while (cond) { LABEL: while (cond) { if (cond) { break LABEL; } else { some_command OTHERLABEL; } } } OTHERLABEL: Or Sara's way: while (cond) { while LABEL (cond) { if (cond) { break LABEL; } else { some_command OTHERLABEL; } } } OTHERLABEL; In the last example. Would OTHERLABEL; be possible technically? Say, *if* we'd want to use it this way some day? If so, I'll give it +2. Ron Korving wrote: > I'd say: > > foreach ($arr as $val) as foo > { > if (true) > break foo; > } > > I don't like the idea at all that labeled breaks are in any way connected to > 'goto' usage. It's my opinion that the two can coexist without a problem, > and that's how I would prefer to see it being used. > > Besides, BAR:while () { } would not do well with a future > goto-implementation, because that would mean it would jump to the beginning > of the loop, and not out of the loop. Maybe you mean to say that labels for > goto and break can exist in the same collection, but I wouldn't be a fan of > that at all. > > Semantically, 'goto' behavior is very different from break-behavior. With a > break I expect to leave a certain construct that has a certain name, with > goto I expect to jump to the line of code that was labeled with a name. I > think the usage is different enough not to want those labels to be the same > kind of things. Maybe other people disagree, but my point is that the > difference in semantics is really something to consider.