Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:20872 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 43949 invoked by uid 1010); 30 Nov 2005 07:28:03 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 43934 invoked from network); 30 Nov 2005 07:28:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Nov 2005 07:28:03 -0000 X-Host-Fingerprint: 66.249.82.195 xproxy.gmail.com Linux 2.4/2.6 Received: from ([66.249.82.195:31493] helo=xproxy.gmail.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 91/CF-14828-2845D834 for ; Wed, 30 Nov 2005 02:28:02 -0500 Received: by xproxy.gmail.com with SMTP id t10so1721675wxc for ; Tue, 29 Nov 2005 23:27:58 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=S/lXDZp7WBBncJt+1gG3N2JonjXsnWbgdUmtKs/s4T+uoBPA5HghlyJ2sQ7broaxLEigDebgWqyHouoMvxHqdaHL5HmWvENRnvacUY0RVpAZYuhn+1x2WJikh/e5vajRf4ShocUaHyHi5nYaC56WqbGGhYI9/7QdRT6u76FRLzs= Received: by 10.70.24.10 with SMTP id 10mr2662035wxx; Tue, 29 Nov 2005 23:27:58 -0800 (PST) Received: by 10.70.41.10 with HTTP; Tue, 29 Nov 2005 23:27:58 -0800 (PST) Message-ID: <7f3ed2c30511292327p1ffae378n9c2bfb01bdb333d3@mail.gmail.com> Date: Wed, 30 Nov 2005 08:27:58 +0100 To: Sara Golemon Cc: internals@lists.php.net In-Reply-To: <2B.E1.14828.4130D834@pb1.pair.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <2B.E1.14828.4130D834@pb1.pair.com> Subject: Re: [PHP-DEV] Labeled Break (nothing at all whatsoever to do with GOTO) From: hannes.magnusson@gmail.com (Hannes Magnusson) Elegant solution, however, I'd prefer while(true) FOO { }. while FOO(true) {} looks like a function call... On 11/30/05, Sara Golemon wrote: > But first, this word from our sponsor: > Group A wants anything resembling goto to burn in the fires of hell > Group B wants full non-crippled goto or nothing at all > Group C wants partial goto (non-backward jumping) or nothing at all > Groups B and C both (generally) want it called either GOTO or JUMP, not > BREAK > > Since no group this size will ever come to an agreement on something this > divisive, I'd like to turn the topic to a completely different language > feature which (might) please enough people to get a rousing consensus. > > Actual labeled breaks. Not the break+jump that was proposed earlier in t= he > guise of a break statement, but an actual straightforward, no funny-busin= ess > labeled break which does no more and no less than the current break N; > construct, but allows the use of identifier labels rather than numbers wh= ich > may change as the result of the addition or removal of break containers. > > http://libssh2.org/patches/true_labeled_break.diff > > Usage: > > while FOO ($condition) { > /* statements */ > break FOO; > /* more statements */ > } > > Or a stacked example: > > for FOO(;;) { > while BAR (true) { > foreach BAZ ($arr as $val) { > switch Foof ($value) { > default: > do Plop { > break FOO; > } while (false); > } > } > } > } > > Notes on this implementation: > > * Labels can't be repeated in an ancestral line. For example, the parser > will throw an ERROR on the following: > while FOO(true) { > while FOO(true) { > break FOO; > } > } > > * Labels can be repeated by siblings. I'm not married to this, and it > certainly has WTF potential. This behavior is easily modified to throw a= n > error. I left it permissable because there was no technical reason to > disallow it. For example, the following is okay: > while FOO(true) { > break; > } > while FOO(true) { > break FOO; > } > > * Labeled breaks also apply to continue; For example: > foreach FOO($arr as $key =3D> $val) { > if ($key % 2) continue FOO; > if (empty(%key)) break FOO; > } > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >