On 23 January 2026 19:48:31 GMT, Larry Garfield <[email protected]> wrote: > >4. The variable pinning syntax. There's been some concerns about it being >non-obvious, which is valid. The main argument for it is "it's what Ruby >does", which is not the most compelling argument, but it's not invalid.
As I think I've said before, for the average PHP user, the question isn't going to be "what's the syntax for variable pinning?", it's going to be "how do I tell if this variable is input to or output from the pattern?" In other words, variable binding and variable pinning syntaxes need to be designed as a pair. Take this example from the RFC: if ($p is Point(z: $z, x: 3, y: $y)) To a PHP programmer who has never seen pattern matching before, that looks like it's testing three properties, not doing some destructuring assignments. If variable pinning isn't supported, they'll soon learn; but if both interpretations are supported with subtly different syntax, I can see it becoming a major source of bugs. Maybe that's why a lot of languages don't support pinning at all? The only way I can think to make this less painful is to have some pair of syntaxes that signals "in" and "out", or "read" and "set", in some way. For example, this looks rather ugly, and may not even be parseable, but it signals the behaviour fairly well without having to read the manual: if ($p is Point(z: $z=, x: 3, y: $y=)) if ($p is Point(z: ==$z, x: 3, y: ==$y)) if ($p is Point(z: ==$z, x: 3, y: $y=)) Regards, Rowan Tommins [IMSoP]
