Re: [PHP-DEV] [RFC] Deprecations for PHP 8.6
[email protected] (Nick Sdot)
| Newsgroups | php.internals |
|---|---|
| Message-ID | <[email protected]> |
On 02.07.26 11:51, Seifeddine Gmati wrote: >> `array_destruct()` that would address the readability argument (which is >> hard to discuss away because it is hyper subjective). > This can't work, and not for stylistic reasons. Destructuring happens > in a *write* context: the construct sits on the left of `=` and > receives bindings. A function can't do that. `array_destruct($a, $b) = > $arr` isn't expressible, functions return values, they don't accept > assignment targets. So a function couldn't replace `list()`; you'd > need a new *construct* to stand in for it, which means adding grammar > rather than removing it. That's the opposite of what the RFC is trying > to do. This is also the crux of the readability point, I think: > `list()` looks like a function precisely because of the parentheses, > but it isn't one, and that mismatch is part of what makes the name > misleading in the first place. Fair enough. I had no idea it couldn't be done. Agreed that adding another language construct doesn't make sense; only the naming isn't enough.