On Fri, Dec 18, 2020, at 1:40 PM, Olle Härstedt wrote:
> What about matching on a variable's type?
> 
> ```
> match {
>   $var: string => "is a string"
>   $var: array => "something else"
> }
> ```
> 
> This could be used with flow-sensitive typing, e.g. assume the type of $var
> being string in the string block. Psalm works like this for if-statements.
> Also consider the case with generics.
> 
> Compare with generalised algebraic data types in FP (GADT).
> 
> Olle

That would be more along the lines of the pattern matching RFC that Ilija and I 
have been kicking around for post-enums: 
https://wiki.php.net/rfc/pattern-matching

That's still in the "it would be cool if" stage only, and is IMO off topic from 
the abbreviation effort in this RFC.

--Larry Garfield

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to