Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71642 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5165 invoked from network); 27 Jan 2014 16:19:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Jan 2014 16:19:12 -0000 Authentication-Results: pb1.pair.com header.from=addw@phcomp.co.uk; sender-id=permerror Authentication-Results: pb1.pair.com smtp.mail=addw@phcomp.co.uk; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain phcomp.co.uk designates 78.32.209.33 as permitted sender) X-PHP-List-Original-Sender: addw@phcomp.co.uk X-Host-Fingerprint: 78.32.209.33 freshmint.phcomp.co.uk Received: from [78.32.209.33] ([78.32.209.33:52488] helo=mint.phcomp.co.uk) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 18/B0-01140-00786E25 for ; Mon, 27 Jan 2014 11:19:12 -0500 Received: from addw by mint.phcomp.co.uk with local (Exim 4.72) (envelope-from ) id 1W7otv-0007Re-OD for internals@lists.php.net; Mon, 27 Jan 2014 16:19:07 +0000 Date: Mon, 27 Jan 2014 16:19:07 +0000 To: PHP internals Message-ID: <20140127161907.GT14262@phcomp.co.uk> Mail-Followup-To: PHP internals References: <52E55D0F.3030308@ajf.me> <52E59BE8.7070202@sugarcrm.com> <20140127110519.GM14262@phcomp.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Parliament Hill Computers Ltd User-Agent: Mutt/1.5.20 (2009-12-10) Subject: Re: [PHP-DEV] PHP and case-sensitivity inconsistency in PHP 6 From: addw@phcomp.co.uk (Alain Williams) On Mon, Jan 27, 2014 at 03:57:01PM +0000, George Bond wrote: > On 27 January 2014 11:05, Alain Williams 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