On Tue, Mar 31, 2020 at 12:51 PM Ilija Tovilo <tovilo.il...@gmail.com> wrote: > > Hi internals > > A few days ago I opened the discussion on the switch expression RFC: > https://wiki.php.net/rfc/switch_expression > > There's been a fundamental disagreement on what the switch expression > should actually be. Due to the conflicting feedback I no longer know > how to proceed. This is why I've created a poll to get a general > feeling of what approach is preferred. If you can vote, **please**, > vote. > > https://wiki.php.net/rfc/poll_switch_expression > > Ilija > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >
To be clear, you actually could reuse the switch keyword for an expression: $x = switch ($y) {/* ... */ }; It's a bit tedious to do but it's not ambiguous. I did a similar thing in the past when working on short closures. I tried using `{$x => $x *2}` for the syntax and had to disambiguate with an empty block (which serves no purpose in PHP). I can't find the branch/patch anymore, which is unfortunate, but it is doable if you are determined. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php