Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:20895 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 25679 invoked by uid 1010); 30 Nov 2005 10:14:33 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 25664 invoked from network); 30 Nov 2005 10:14:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Nov 2005 10:14:33 -0000 X-Host-Fingerprint: 160.9.128.16 dns1.lmu.ac.uk Received: from ([160.9.128.16:23045] helo=mrelay-a.lmu.ac.uk) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 75/E9-14828-18B7D834 for ; Wed, 30 Nov 2005 05:14:26 -0500 Received: from localhost.lmu.ac.uk ([127.0.0.1] helo=localhost) by mrelay-a.lmu.ac.uk with esmtp (Exim 4.43) id 1EhOtc-0005po-La; Wed, 30 Nov 2005 10:09:04 +0000 Received: from mrelay-a.lmu.ac.uk ([127.0.0.1]) by localhost (mrelay-a [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 21497-03; Wed, 30 Nov 2005 10:09:02 +0000 (GMT) Received: from leedsmet-exch1.leedsmet.ac.uk ([160.9.35.117]) by mrelay-a.lmu.ac.uk with esmtp (Exim 4.43) id 1EhOq4-0005ki-UH; Wed, 30 Nov 2005 10:05:25 +0000 x-mimeole: Produced By Microsoft Exchange V6.5.6944.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Wed, 30 Nov 2005 10:06:02 -0000 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PHP-DEV] Labeled Break (nothing at all whatsoever to do with GOTO) Thread-Index: AcX1T+NFErR8dWIZS9eQuwQE0M+R/gARHNkA To: "Sara Golemon" , X-Virus-Scanned: by McAfee at Leeds Metropolitan University Subject: RE: [PHP-DEV] Labeled Break (nothing at all whatsoever to do with GOTO) From: M.Ford@leedsmet.ac.uk ("Ford, Mike") On 30 November 2005 01:41, Sara Golemon wrote: > , I'd like to turn the topic to a completely > different language > feature which (might) please enough people to get a rousing consensus. >=20 > Actual labeled breaks. Not the break+jump that was proposed > earlier in the > guise of a break statement, but an actual straightforward, no > funny-business labeled break which does no more and no less than the > current break N; construct, but allows the use of identifier labels > rather=20 > than numbers which > may change as the result of the addition or removal of break > containers. Well, as this is exactly what I proposed just yesterday, I'm + several thou= sand for it (modulo my fairly nonexistent karma!). I'd love to see this im= plemented regardless of what happens to goto, as I completely don't care wh= ether PHP has goto or not. =20 >=20 > http://libssh2.org/patches/true_labeled_break.diff >=20 > Usage: >=20 > while FOO ($condition) { > /* statements */ > break FOO; > /* more statements */ > } >=20 > Or a stacked example: >=20 > for FOO(;;) { > while BAR (true) { > foreach BAZ ($arr as $val) { > switch Foof ($value) { > default: > do Plop { > break FOO; > } while (false); > } > } > } > } I'm fairly agnostic on which syntax to use, although I see some benefit in = distinguishing break labels from goto labels. I do quite like the "as" sug= gestion -- it seems really clear and readable. =20 > * Labels can be repeated by siblings. I'm not married to this, and it > certainly has WTF potential. Mmmm -- not too sure about this. As you say, it possibly has slightly too = much WTF potential. > * Labeled breaks also apply to continue; For example: Of course. I thought that went without saying. ;) 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=20 To view the terms under which this email is distributed, please go to http:= //disclaimer.leedsmet.ac.uk/email.htm