Re: [RFC][POLL] Switch expression

From: Date: Wed, 01 Apr 2020 11:19:21 +0000
Subject: Re: [RFC][POLL] Switch expression
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-109496@lists.php.net to get a copy of this message
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'; > case 1: > break 'Bar'; > case 2: > break 'Baz'; > } We can't really do that since break already accepts an integer telling it how many enclosing structures it should jump out of. > The other issues discussed in your RFC - fallthrough, inexhaustiveness, > type coercion - are valuable things to discuss, but each one takes this > further away from being a "switch expression", and into being "a new > value-matching expression". As I said in my last e-mail, I don't think > that's a bad thing; I really like the proposed syntax, as a new > construct for picking one of a set of expressions, and would be happy to > see the RFC re-focussed in that direction. Yes, I can absolutely see your point. The point of the poll is to see what direction we should take. After that I'll try to clean up the RFC. Thanks! Ilija

« previous php.internals (#109496) next »