Re: Suggestion for constants required by classes

From: Date: Thu, 12 Jan 2006 07:34:57 +0000
Subject: Re: Suggestion for constants required by classes
References: 1  Groups: php.pear.qa 
Request: Send a blank email to pear-qa+get-3378@lists.php.net to get a copy of this message
Bonjour, as any know, the question exists earlier than php5. Constants as error constants are defined as numbers. What insure there's no collisions there ? Nothing, there are some. Clever, not lazy devs check them manually, within related packages. So yes, +1 for using any namespace php5 could afford. à+ -- toggg Gustavo Narea wrote:
Dear PEAR QA: I think constants required by classes should not be defined in a global scope but within the same class. I suggest this because of semantic reasons, as well as in order to avoid them to be already defined in another place within the script. For instance, use this line in PEAR::DB: const ERROR = -1; instead of: define('DB_ERROR', -1); What do you think about it? Could it be taken into account for the coding standards? Thanks for your attention. Regards. Gustavo Narea.


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