Re: [PHP-DEV] [RFC] Deprecations for PHP 8.6

[email protected] (Ayesh Karunaratne)
Newsgroups php.internals
Message-ID <CANLbj-pzZYKKcauiv4PZGUoCpxT2+t0J8cgvxC+2TTQ+th4GzQ@mail.gmail.com>
> I have updated the RFC to include a deprecation proposal for the
> `list()` construct.
>
> ref: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_the_list_construct
>

Hi Seifeddine,
I understand the reasoning behind freeing up the `list` keyword and
having a canonical way to destructure an array. However, I would argue
that the scale of this BC break far outweighs the benefits.

A quick GitHub code search shows 7 million[^1] hits for "list(" in PHP
files. If we deprecate and eventually drop `list()` in PHP 9, we can
safely assume that a large portion of existing code will fail to
compile in PHP 9.

Furthermore, the documentation for `list()` offers no hint that `[]`
is preferred over `list()`, and I would also argue that there is no
reason to prefer one over the other. Code-style guides can dictate a
project's or library's conventions, but we should take a more
conservative approach if we really have a strong technical reason to
prefer one syntax over another.

Based on the RFC text, aside from freeing up the `list` keyword for
potential future use, I do not see a sufficiently strong technical
reason to deprecate `list()`.

Thank you.

[^1]: https://github.com/search?q=%22list%28%22+language%3APHP+&type=code
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.