Re: [RFC] Match expression
| From: | Rowan Collins | Date: | Sun, 10 Sep 2017 20:18:30 +0000 |
| Subject: | Re: [RFC] Match expression | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-100511@lists.php.net to get a copy of this message | ||
On 10/09/2017 20:16, Theodore Brown wrote:
On Sunday, September 10, 2017 12:45 PM Rowan Collins <rowan.collins@gmail.com> wrote:The choice of "use" as the keyword was largely because it's already a reserved word, with multiple meanings in different contexts. As well as anonymous functions, it's the keyword for importing names from other namespaces, and for including a trait into a class. I would be perfectly happy to hear alternative keyword or syntax suggestions. It might not need a keyword at all, as it could just be "switch ($i ===) { ... }" or "switch ($i) === { ... }", although I'm not that keen on either of those. However, I think using "===" in some form is definitely clearer than ", true", which could mean anything; and even "strict" could have multiple meanings - for instance, a "strict switch" might be one where "break" was mandatory. Regards, -- Rowan Collins [IMSoP]parameter. What do either of you think of my "switch-use" proposal, which would spell this as "switch ($i) use (===)"? That seems more complicated and confusing than either of the other options. NormallyWould it be possible to add an optionalI'd very much prefer a "strict switch ($i) { ... }" over a second$strictparameter to switch? E.g.switch ($i, true) {use()is for inheriting variables in anonymous functions.