Re: PHP and case-sensitivity inconsistency in PHP 6
On 27 January 2014 11:05, Alain Williams <[email protected]> wrote:
> On Sun, Jan 26, 2014 at 03:36:08PM -0800, Stas Malyshev wrote:
> * there are a few special values that are currently case insenitive, eg:
> NULL, TRUE.
> I would suggest that they only be recognised in upper case, eg: null
> would be
> invalid. This fits with the meme of constant names being in upper case.
>
Why would you want
FUNCTION tellMeEverythingIsOk(){
ECHO TRUE;
}
to work but not
function tellMeEverythingIsOk(){
echo true;
}
?? true/false/null aren't constants, they're language constructs like
'array' and 'callable' (and arguably 'function') - or at least
they're part
of the same group (base types) and would expect them to have the same case
conventions. I wouldn't think anyone would want to enforce $var = ARRAY(
'foo' ); on the PHP world.
If we're enforcing case sensitivity with the true/false/null keywords, I'd
expect 'true' to be the primitive type, 'TRUE' to be a constant that
someone could define for some dubiously-sensible purpose (like having the
value needed to be set in some database), and 'True' to be a class that
someone could define for a slightly more sophisticated purpose ($t = new
True(); try { $db->set( 'field', $t->getForDatabase() ); } catch { echo
"Could not set field to {$t->getHumanReadable()} ). But I don't see any
reason to make true/false/null case sensitive (whichever canonical casing
you then choose) in the first place.
G
Thread (15 messages)