Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:20807 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58896 invoked by uid 1010); 29 Nov 2005 09:43:31 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 58881 invoked from network); 29 Nov 2005 09:43:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Nov 2005 09:43:31 -0000 X-Host-Fingerprint: 160.9.128.17 dns2.lmu.ac.uk Received: from ([160.9.128.17:31339] helo=mrelay-b.lmu.ac.uk) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 28/49-21657-1C22C834 for ; Tue, 29 Nov 2005 04:43:29 -0500 Received: from localhost.lmu.ac.uk ([127.0.0.1] helo=localhost) by mrelay-b.lmu.ac.uk with esmtp (Exim 4.43) id 1Eh20v-0007BM-RJ for internals@lists.php.net; Tue, 29 Nov 2005 09:43:06 +0000 Received: from mrelay-b.lmu.ac.uk ([127.0.0.1]) by localhost (mrelay-b [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 26894-02 for ; Tue, 29 Nov 2005 09:43:03 +0000 (GMT) Received: from leedsmet-exch1.leedsmet.ac.uk ([160.9.35.117]) by mrelay-b.lmu.ac.uk with esmtp (Exim 4.43) id 1Eh1wO-00074w-R1 for internals@lists.php.net; Tue, 29 Nov 2005 09:38: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: Tue, 29 Nov 2005 09:39:01 -0000 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PHP-DEV] Re: Labeled Breaks (not the G-word) Thread-Index: AcX0xkXabEf2jzW5TRiQths85WRbTwAAKIFQ To: X-Virus-Scanned: by McAfee at Leeds Metropolitan University Subject: RE: [PHP-DEV] Re: Labeled Breaks (not the G-word) From: M.Ford@leedsmet.ac.uk ("Ford, Mike") On 29 November 2005 09:18, Bart de Boer wrote: > I feel we're comparing apples with oranges here. >=20 > 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: >=20 > while (loop) { > goto LABEL; > } > > LABEL >=20 > while (loop) { > break; > } >=20 > 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 ha= ve 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 r= emoving an inner loop and failing to notice that a break/continue count nee= ds incrementing/decrementing. Labelled breaks are a relatively simple addi= tion to the syntax that would improve the programming experience out of all= proportion. Yes it's complete syntactic sugar -- it doesn't do anything y= ou can't currently do, just does it in a much more friendly way -- but incr= edibly 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=20 To view the terms under which this email is distributed, please go to http:= //disclaimer.leedsmet.ac.uk/email.htm