Le jeudi 20 juin 2024, 19:38:40 UTC+2 Larry Garfield a écrit :
> To that end, we're looking for *very high level* feedback on this RFC:
>
> https://wiki.php.net/rfc/pattern-matching
Hello,
Thank you for this RFC.
Sorry if that’s a bit focused on syntax, but I’m really concerned by the binding syntax.
I would totally expect both these codes to do the same thing:
```
if ($o is Class{prop: 3}) {
```
and:
```
$x = 3;
if ($o is Class{prop: $x}) {
```
I’ve seen someone else in the discussion propose to invert the logic between binding and use a
variable and I agree, it’s the binding/capture which should have the special syntax.
Either another operator than ':', I’ve seen '=>' proposed. Or any other
idea to differentiate it.
'=>' would allow to combine match and capture like this:
$o is Class{prop: int => $y}
Côme