On 15.06.2018 at 08:36, Sebastian Bergmann wrote: > Am 14.06.2018 um 10:35 schrieb Nikita Popov: > >> It might make sense to introduce an entirely new "match" statement >> that conforms a bit more with how switch-like strictures are >> implemented nowadays. That is, something like >> >> match ($expr) { >> "foo" => {...}, >> "bar" | "baz" => {...}, >> } >> >> or similar. > > Interesting. Can you provide a pointer to a language that has a match > statement like that?
This match statement (or would it be an expression?) could be regarded as an extremly simplified syntactic variant of the case-of expression of Standard ML[1]. Instead of the pipe operator we could use a comma to separate multiple “patterns”. Using “case” instead of “match” appears to be something to consider as well. [1] <https://www.cs.cornell.edu/courses/cs312/2004fa/lectures/lecture3.htm>, section “Pattern Matching” -- Christoph M. Becker -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php