CS, constants and exceptions [WAS cvs: pear /Mail_Mime mime.php]
| From: | Sean Coates | Date: | Thu, 16 Dec 2004 19:23:28 +0000 |
| Subject: | CS, constants and exceptions [WAS cvs: pear /Mail_Mime mime.php] | ||
| References: | 1 2 3 4 | Groups: | php.pear.qa |
| Request: | Send a blank email to pear-qa+get-2218@lists.php.net to get a copy of this message | ||
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 them14:05 <@Derick> they lie 14:05 < sean> can I quote you? (-: 14:05 <@Derick> yes 14:05 < sean> thank you.
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. 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. 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. S