Re: Removal of ${} string interpolation in PHP 9
| From: | Ben Ramsey | Date: | Sun, 22 May 2022 02:26:01 +0000 |
| Subject: | Re: Removal of ${} string interpolation in PHP 9 | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-117763@lists.php.net to get a copy of this message | ||
On 5/20/22 04:05, Ilija Tovilo wrote:
Attachment: [application/pgp-keys] OpenPGP public key OpenPGP_0xF9C39DC0B9698544.asc
Attachment: [application/pgp-signature] OpenPGP digital signature OpenPGP_signature.asc
Hi everyone It was pointed out to me that unfortunately the "Deprecate ${} string interpolation" RFC didn't specify *how* the feature would be removed in PHP 9. https://wiki.php.net/rfc/deprecate_dollar_brace_string_interpolation https://github.com/php/php-src/issues/8501 There are two approaches: * Completely remove the syntax and make "${}" result in the literal string "${}" * Keep the syntax in the parser but throw an error It's pretty clear to me that the latter is preferable for two reasons: 1. People upgrading directly from <=PHP 8.1 to PHP 9.0 or people who have not addressed the deprecations will still get an appropriate compile-time error message instead of their code suddenly behaving differently. 2. We can reuse the syntax at some point without causing another BC break. The only advantage of the former approach I can think of is easier (or rather no) escaping of ${} in strings but this could also be a drawback considering that it would become unclear what the original intent of the code was (literal output or string interpolation). So unless there are concerns I will amend that in the RFC. Regards, IlijaIn my reading of the RFC, I assumed the first approach: completely remove the syntax and make "${}" result in the literal string "${}". IMO, this is not an insignificant change to the RFC. I'd like to hear from those who voted on the RFC before you make this change. Cheers, Ben
Attachment: [application/pgp-keys] OpenPGP public key OpenPGP_0xF9C39DC0B9698544.asc
Attachment: [application/pgp-signature] OpenPGP digital signature OpenPGP_signature.asc