Re: Constants

From: Date: Mon, 03 Dec 2001 19:03:23 +0000
Subject: Re: Constants
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-72365@lists.php.net to get a copy of this message
On Mon, 03 Dec 2001, Andi Gutmans wrote: > Hi, > > I'm trying to wrap up the class wide constants in ZE2. I implemented them > so that class wide constants are case-sensitive. I think in general, > although ZE1 allows you to define case-insensitive constants it's better > for performance and for general esthetics. > > I have two issues I'd like to get some input on: > > a) There are almost no constants in PHP which are case-insensitive (which > aren't user land defined with define()). Actually the only ones I could > find are in the Zend Engine such as TRUE & FALSE which makes sense. All PHP > extensions which use REGISTER_LONG_CONSTANT() and friends use the CONST_CS > (case-sensitive flag). I would like to change these macros to *always* > register as case-sensitive. Unless I missed some extensions this shouldn't > bite anyone as all extensions seem to use CONST_CS. Of course I won't > change the special purpose constants such as TRUE & FALSE which are today > registered as case-insensitive. What do you guys think? Makes sense. I'd also like to request that the engine be able to distinguish between FOO_BAR and Foo_BAR constants, for example. > b) REGISTER_MAIN_LONG_CONSTANT() and friends (notice the MAIN) are used to > register constants which shouldn't be unloaded when the PHP extension is > unloaded. I can't think of many cases where this is applicable. For > example, if the pspell extension is unloaded I think all of its constants > should be unloaded too. However, this extension is one example of an > extension using the _MAIN_ macro. Can each of you check your extension and > move to REGISTER_LONG_CONSTANT() unless there's a good reason not to? I don't think any of mine do this. -Andrei * Think digital, act analog. *

« previous php.dev (#72365) next »