Re: Deprecate alternate switch case syntax?
| From: | Theodore Brown | Date: | Wed, 20 Nov 2024 18:45:35 +0000 |
| Subject: | Re: Deprecate alternate switch case syntax? | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-126006@lists.php.net to get a copy of this message | ||
On Wed, Nov. 20, 2024 at 11:38 Larry Garfield wrote:
> Unless it's causing parser issues somewhere I don't think we *need* to address it.
> Maybe just document that one really shouldn't use it, and it's only there for legacy
> reasons. That said, if someone wants to go to the work of removing it, I'd probably support
> it.
I don't feel particularly strongly about it, but I am inclined to write an RFC to deprecate it,
since removing some of these little-known legacy syntaxes makes the language cleaner and less
confusing, and sometimes can even pave the way for future features.
For example, the curly brace syntax for accessing array elements and string offsets was deprecated
in PHP 7.4,[1] and if I recall this made possible the property hooks syntax we have now in PHP 8.4.
Sincerely,
Theodore
[1]: https://wiki.php.net/rfc/deprecate_curly_braces_array_access