Hi all,
Opening the vote on loop + or control structures.
https://wiki.php.net/rfc/loop_or
Voting will close in 1 week and requires a 2/3 in favour to pass.
Remember at this stage the implementation is flexible.
Cheers,
Leigh.
Opening the vote on loop + or control structures.
https://wiki.php.net/rfc/loop_or
Voting will close in 1 week and requires a 2/3 in favour to pass.
Remember at this stage the implementation is flexible.
Hi,
After talking with other members of AFUP, it seems most of us like the
idea of having some way of executing code if a loop is never executed.
The "or" keyword feels a bit odd to those who are used to the "else" of
Twig (or other languages) -- but it's not really that much of a problem
either: after a while, we'll get used to using "or" (or some other keyword).
So, we would be on the +1 side of things on this.
Still, Sara's idea of giving all loop constructs a return value
indicating the number of times the loop executed feels great -- and this
would probably be more flexible than loop...or
I'm guessing this is why you voted "no" on your own RFC?
--
Pascal MARTIN, AFUP - French UG
http://php-internals.afup.org/
I'm guessing this is why you voted "no" on your own RFC?
Getting this feature working was the result of several compromises,
and I didn't like the idea of feeling like "I wish this was different,
oh wait... it's my fault..." every time I used it.
It really did boil down to syntactic sugar. There was a small
performance gain on large loops compared to using a tracking variable,
but it wasn't really enough to overcome my negative feelings towards
it.
The groundwork and proof of concept patch is there. If someone else
knows how to make it sexy, they're free to pick it up and run with it
:)