On Mon, Jan 27, 2014 at 03:57:01PM +0000, George Bond wrote:
> 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;
> }
I am trying to raise the issue. Thanks for joining the discussion.
> ?? 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.
We want to do what breaks least code - while accepting that some code will become broken.
What I see in random code that I come across is: TRUE, true and True. Maybe we
should accept those and not things like 'tRue'.
> I wouldn't think anyone would want to enforce $var = ARRAY(
> 'foo' ); on the PHP world.
Agreed, I was not suggesting that. It seems to be conventional that keywords
like 'function' should be in lower case, I was not aware that you could put it
in upper case (you can, I just tried), but all the documentation suggests that
it should be lower case.
> 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.
It does make it consistent with the change towards case sensitivity in function names.
--
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer.
+44 (0) 787 668 0256 http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php
#include <std_disclaimer.h>