Re: [PHP-DEV] [RFC] Deprecations for PHP 8.6
[email protected] (Seifeddine Gmati)
| Newsgroups | php.internals |
|---|---|
| Message-ID | <CAFyg4HgL4U6Sf2DizBJDtKxPeC5Y=ZV-CQJ5qyYbXmc3pZfpxQ@mail.gmail.com> |
On Thu, 2 Jul 2026 at 01:11, Juliette Reinders Folmer <[email protected]> wrote: > Ahum.... I'm one of the maintainers of the WordPress Coding Standards, which is the team which would address these type of syntax changes for WP. Fair enough, and I'll happily take your word on the WP side. So I withdraw the "cautious about treating it as WP's position" point. It doesn't change my conclusion, though. That a group of core committers has repeatedly blocked short-array syntax for their own codebase is entirely their prerogative, but it's a project style decision, not an argument about the language. WordPress doesn't set PHP's direction, and "one large project prefers the older form" can't be the reason PHP keeps a redundant construct indefinitely. Styles adapt to the language at the version they target; that's the normal direction of the relationship. > The fact that the `list()` name may be confusing is IMO not a valid argument. That keyword has been in use for that particular purpose since a very long time in PHP - and even longer in other languages. I disagree. As far as I'm aware, no other language uses `list` as the *destructuring construct*; please point me to one if you know it, I'd be genuinely interested. The languages I know all use a bracket/paren form with no keyword: JS `[a, b] = arr`, Python `a, b = seq`, Rust `let [a, b] = arr`, Swift `let (a, b) = t`. Others, such as SML, OCaml, and Haskell, have a "List" module or type, but again, that's a different thing. Perl is the closest relative and I suspect PHP's inspiration, but Perl writes it as bare parentheses, `($a, $b) = @arr`, and calls the operation "list assignment," where "list" means the parenthesised list of values. There's no `list(...)` keyword doing the unpacking. And that actually cuts the other way: Perl can call it "list assignment" because Perl has a genuine first-class list. PHP doesn't have a list type at all, so the keyword names something that doesn't exist in the language. It destructures an array and even accepts keys (`list("k" => $v) = $a`), which a genuine "list" would not. Cheers, Seifeddine