Re: Deprecate and remove case-insensitive constants?
| From: | Rowan Collins | Date: | Tue, 12 Sep 2017 16:17:28 +0000 |
| Subject: | Re: Deprecate and remove case-insensitive constants? | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-100544@lists.php.net to get a copy of this message | ||
On 12 September 2017 15:52:38 BST, Levi Morrison <levim@php.net> wrote:
> array_map(sum2, $input1, $input2);
>
>Currently that requires
sum2 to be a constant.
I'm not clear what this has to do with case sensitivity; the problem here is that we don't
have a type of "function reference" (nor "class reference") so simulate such
references with strings and runtime assertions.
Are you saying that without case sensitivity, the language could deduce that sum2 in that case was a
function reference? That seems optimistic: not only can you have a class, a constant, and a function
all with the same name, but you can't actually know which exists until the line is executed,
because all three can be defined at any time.
This kind of ambiguous syntax is precisely what I was trying to reduce by deprecating
"undefined constant as string", and a similar "convenient fallback" (from
current to global namespace) is currently the biggest thing blocking function autoloading.
If we want function and class references, they should have their own, unambiguous, syntax.
Apologies if I've completely missed the point here.
Regards,
--
Rowan Collins
[IMSoP]