Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77383 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 22085 invoked from network); 20 Sep 2014 14:43:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Sep 2014 14:43:50 -0000 Authentication-Results: pb1.pair.com header.from=leight@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=leight@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.179 as permitted sender) X-PHP-List-Original-Sender: leight@gmail.com X-Host-Fingerprint: 74.125.82.179 mail-we0-f179.google.com Received: from [74.125.82.179] ([74.125.82.179:49192] helo=mail-we0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 02/E4-24334-5A29D145 for ; Sat, 20 Sep 2014 10:43:50 -0400 Received: by mail-we0-f179.google.com with SMTP id u56so968606wes.24 for ; Sat, 20 Sep 2014 07:43:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=186xNilHFSNymbx0+nqGLNB9HveGJHt/oMYkuCnMJ7o=; b=gDowWxZJhrgj5atq4/x/XbMMdtntBmm8DRgg0rNspUUMkOvK4dRPOUXFwexA9TQKH6 cjjVUb6Fi+2T9VfjueC4BzvGf6Y868lhGWTCOeyU8OzVtEknMw9WayWYKHNf4FlCGeGC 6rcPgzeW9bHgDWqodzbY+1vJgTd486nXDnXAge6XVV9mABi1SE+DfWyz7xlvZe6HvFtz bnXOJaMcjKiLsuUlTPckC/6nAbOuCRsc3obAY+Az7HC3JB9tAhmKmSbrWxMezwaW+rWa /f+Mped7ji2fxoo1v+iCPQhij++yVPtp0EAV1dP6cblyjIIFDDRVUR1IKmm4hV1CraRi Gp7Q== MIME-Version: 1.0 X-Received: by 10.180.10.38 with SMTP id f6mr3684498wib.30.1411224226605; Sat, 20 Sep 2014 07:43:46 -0700 (PDT) Received: by 10.217.55.195 with HTTP; Sat, 20 Sep 2014 07:43:46 -0700 (PDT) In-Reply-To: <541CC433.7050205@gmail.com> References: <541CC433.7050205@gmail.com> Date: Sat, 20 Sep 2014 15:43:46 +0100 Message-ID: To: Rowan Collins Cc: internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] Loop... or... From: leight@gmail.com (Leigh) On 20 September 2014 01:02, Rowan Collins wrote: > > It seems like there are actually quite a number of special blocks you > *could* define, such as: > > a) When the body is executed zero times (proposed "or" block) > b) When the body is executed exactly once (in a do...while loop, as > mentioned in the RFC) > c) After every iteration of the loop, even if the iteration was ended early > (Perl's "continue" block [1], where "next" is equivalent to PHP's > "continue") > d) After every iteration of the loop, *only* if the iteration was ended > early (would have a similar relationship to (c) as "catch" does to > "finally") > e) After the end of the loop, if "break" was not used (Python's "else" block > [2]) > f) After the end of the loop, if "break" WAS used > Some or all of these can be implemented (in other RFCs). However in order to avoid specifying every permutation in the grammar it would require converting loop structures that currently have a defined number of children, into list structures ("if" behaves like this, with multiple optional "elseifs" and an optional "else"). Obviously the complexity increases with each new type of block but I think the type being addressed in this RFC, and the python-style type can live side-by-side pretty happily. So, lets deal with this one first, and then I will work on a python-style one afterwards (promise)