Re: Deprecate and remove case-insensitive constants?
| From: | Levi Morrison | Date: | Tue, 12 Sep 2017 14:55:50 +0000 |
| Subject: | Re: Deprecate and remove case-insensitive constants? | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-100542@lists.php.net to get a copy of this message | ||
> By itself this change provides little value. If it was done in
> connection with other features such as merging symbol tables then we
> can actually gain some significant improvements:
>
> array_map(sum2, $input1, $input2);
>
> Currently that requires
sum2 to be a constant. To get the
> correct
> behavior we currently need to do:
>
> array_map('fully\qualified\namespace\sum2', $input1, $input2);
After rewriting my reply I noticed this sentence doesn't quite make sense:
> This is not just convenience; it provides safety to refactoring and
> general code analysis tools.
Instead I meant that using the string is not just inconvenient; it
also prevents fully-safe code refactoring and analysis.
> Maintenance is a crucial aspect of large
> code bases and being able to move away from stringly-typed things is a
> significant improvement. It's also a step towards general autoloading
> instead of just class/trait/interface autoloading; however this would
> require further changes.
>
> I believe these improvements would be worth it and do understand it is
> a large backwards compatibility break. Given sufficient time and
> tooling to prepare I think PHP would be markedly better in the
> long-run for these two changes. However, if we change only the case
> sensitivity of constants we gain little value for our BC break.