Re: [PHP-DEV] [RFC][POLL] Switch expression

2020-04-01 Thread Rowan Tommins
On 01/04/2020 12:19, Ilija Tovilo wrote: We can't really do that since break already accepts an integer telling it how many enclosing structures it should jump out of. Sure, but we could use "return", or some other keyword. My point was that the syntax could look a lot closer to a switch sta

Re: [PHP-DEV] [RFC][POLL] Switch expression

2020-04-01 Thread Ilija Tovilo
Hi Rowan I agree that the structure of the RFC is sub optimal. Honestly, I've rewritten and moved things at least 5 times and it's still not good. I'll see how I can improve it. > so we could maybe combine them with the break keyword: > > $y = switch ($x) { > case 0: > break 'Foo';

Re: [PHP-DEV] [RFC][POLL] Switch expression

2020-04-01 Thread Rowan Tommins
On 01/04/2020 09:56, Rowan Tommins wrote: If the intention is to make this feel like an expression version of the switch statement, then making it look more similar would make sense. To expand on this a bit, if the aim is "a switch statement, but usable as an expression", then it would make

Re: [PHP-DEV] [RFC][POLL] Switch expression

2020-04-01 Thread Rowan Tommins
On 31 March 2020 19:50:59 BST, Ilija Tovilo wrote: >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. I think this confusion is there in your proposal, not just in people's responses to it.

Re: [PHP-DEV] [RFC][POLL] Switch expression

2020-04-01 Thread Ilija Tovilo
Hi internals After Levis email yesterday we discussed his suggestions in private. I did some investigation and did find a way to reuse the current switch syntax. The main problem of the ambiguity was the empty switch statement vs expression: ``` // Could be a switch expression or a switch stateme

Re: [PHP-DEV] [RFC][POLL] Switch expression

2020-03-31 Thread Levi Morrison via internals
On Tue, Mar 31, 2020 at 12:51 PM Ilija Tovilo 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 con

Re: [PHP-DEV] [RFC][POLL] Switch expression

2020-03-31 Thread David Rodrigues
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. An

[PHP-DEV] [RFC][POLL] Switch expression

2020-03-31 Thread Ilija Tovilo
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