Re: CS, constants and exceptions [WAS cvs: pear /Mail_Mime mime.php]

From: Date: Thu, 16 Dec 2004 19:58:40 +0000
Subject: Re: CS, constants and exceptions [WAS cvs: pear /Mail_Mime mime.php]
References: 1 2 3 4 5  Groups: php.pear.qa 
Request: Send a blank email to pear-qa+get-2219@lists.php.net to get a copy of this message
On Thu, 16 Dec 2004 14:23:28 -0500, Sean Coates <sean@caedmon.net> wrote: > Justin Patrin wrote: > > true, false, and null are language constructs, not constants. > > Well, no, they're not. > php -r "print_r(get_defined_constants());" | egrep "TRUE|FALSE|NULL" > [TRUE] => 1 > [FALSE] => > [NULL] => > > They're clearly defined as constants in > php-src/ZendEngine2/zend_constants.c (in zend_register_standard_constants). > > Additionally: > 14:03 < sean> TRUE, FALSE and NULL -- constants or not? > 14:04 <@Derick> sean: yeah > 14:04 < sean> the pear guys are telling me they're language constructs. > Is there any merit to that? > 14:04 <@Derick> let me check > 14:05 < sean> php -r "print_r(get_defined_constants());" | egrep > "TRUE|FALSE|NULL" shows them > 14:05 <@Derick> they lie > 14:05 < sean> can I quote you? (-: > 14:05 <@Derick> yes > 14:05 < sean> thank you. Well I'll be... I *assumed* that they were constructs instead of constants. Nevertheless, these are language constants and not code constants. The intent of the CS (AFAIK) is that any constant defined and used in source code must be all uppercase. Language defined constants, such as true, false, and null, have for a while been asked to be lower-case. > > > This isn't currently in the CS on the website, but it is generally accepted > > as CS and always mentioned in proposal comments. > > I don't think it's fair to expect new developers (and maintainers, such > is my case) to read through dozens of proposals for CS "accepted > practice," especially when there's already what appears to be an > authoritative document on this. Yes, I agree. The doc on pearweb should be updated to include all of the CS. > > I really don't mean to drag this out, but the manual should state that > constants EXCEPT true, false and null should be uppercased. I'll send a > patch to PEAR-DOC if QA is in agreement. As above, I would amend it to say that language-defined constants should be lower-case and source-defined constants should be upper-case. > > Also, are there any other constants that should not be uppercased, that > should be indicated? > (you'll notice that I've reverted my patch on mime.php) > > Oh, and Pierre: sorry for arguing before Christmas. > I apologize also, but we're still more than a week from Christmas. ;-) -- Justin Patrin

« previous php.pear.qa (#2219) next »