On 20 September 2014 01:02, Rowan Collins <rowan.coll...@gmail.com> 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) -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php