Re: Deprecate and remove case-insensitive constants?

From: Date: Thu, 14 Sep 2017 16:25:13 +0000
Subject: Re: Deprecate and remove case-insensitive constants?
References: 1 2 3 4 5 6 7 8 9  Groups: php.internals 
Request: Send a blank email to internals+get-100600@lists.php.net to get a copy of this message
On 14.09.2017 at 17:37, François Laupretre wrote: > Le 14/09/2017 à 15:38, Alain Williams a écrit : > >> I vote for making it case sensitive: simpler for the parser; the >> programmer >> rapidly learns that it should be 'TRUE' and not 'true' -- job done. > > No need to force people to switch their code to 'TRUE'. Just supporting > case-sensitive 'TRUE', 'true', and 'True' (the same for false and > null) > should be enough. Not supporting 'tRUE' or 'TrUe' anymore will also be a > positive side effect for code readability. I'd rather not introduce a special case here. All PHP keywords are currently case-insensitive (CMIIW), so promoting true, false and null from reserved words to keywords would solve this issue: all constants are case-sensitive, all keywords are case-insensitive, the latter obviously taking precedence. And frankly, if somebody really prefers to write "TruE", why bother? This would still be far from having a chance to win a "most obfuscated code contest". -- Christoph M. Becker

« previous php.internals (#100600) next »