Re: [RFC][POLL] Switch expression
| From: | David Rodrigues | Date: | Tue, 31 Mar 2020 19:29:09 +0000 |
| Subject: | Re: [RFC][POLL] Switch expression | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-109488@lists.php.net to get a copy of this message | ||
In relation to "Some people have asked why we don't reuse the syntax of the
switch statement". I do not think that it could cause a conflict with an
array. The same is valid for anonymous functions or classes: you need use
terminator (";"). I still prefer it than create another format to switch.
And maybe you should just use "return" here to specify the return value.
$x = switch ($y) {
case 1: return $y + 1;
case 2: return $y - 1;
// default: return null;
};
Atenciosamente,
David Rodrigues
Em ter., 31 de mar. de 2020 às 15:51, Ilija Tovilo <tovilo.ilija@gmail..com>
escreveu:
> 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
>
>