Re: [Pre-RFC] Pure-code source files via .phpc extension
| From: | Rowan Tommins [IMSoP] | Date: | Sun, 31 May 2026 08:38:56 +0000 |
| Subject: | Re: [Pre-RFC] Pure-code source files via .phpc extension | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-131070@lists.php.net to get a copy of this message | ||
On 29 May 2026 17:26:26 BST, Michael Morris <tendoaki@gmail.com> wrote:
>This honestly would need to be part of a larger syntax cleanup effort for
>the benefit of both the engine and the users. The largest single wart in
>PHP syntax is the having three scope operators ( \, ->, :: ) where its
>sister languages get by with only one ( . ) which PHP uses for a different
>operation. But I believe that runs into similar problems as the reason why
>PHP requires $ to lead all variables, it has to do with how the engine
>handles these symbols. I suspect that some of these problems are
>intractable and even if they can be solved the performance hit in solving
>them might be severe. If that isn't the case (or isn't the case anymore)
>then those structures too would be worth review.
Hendrik's original proposal seems pointless but mostly harmless. I'd probably vote against
because it's just unnecessary complexity.
A mode that lets you write PHP code with all the syntax spelled with different symbols sounds about
as practical as the module which lets you write Perl code using grammatically correct Latin: https://metacpan.org/dist/Lingua-Romana-Perligata/view/lib/Lingua/Romana/Perligata.pm
Every time you wanted to use an example from online, or just move some code from one file to
another, you'd have to use a tool to translate it from "traditional PHP" to
"all-new looksmaxxed PHP".
A "strict mode" that turns off certain features has been proposed many times over the
years, and always rejected in favour of moving the language in a consistent direction.
If you just want to forbid those features in your own programs, use a static analyser. If you want
to remove their complexity from the language, a "strict mode" won't help.
Rowan Tommins
[IMSoP]