PHP5 and namespaces for PEAR packages.

From: Date: Fri, 04 Apr 2003 01:36:14 +0000
Subject: PHP5 and namespaces for PEAR packages.
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-14865@lists.php.net to get a copy of this message
I've been converting some of my Math_* packages to make use of PHP5 goodies (code not on CVS yet). One thing that I would like to be discussed, either in the list, the irc/personal/teleconference PEAR meeting, or both, is how are we going to structure the namespaces. For example, we could use: namespace PEAR:Math { class Vector { ... } } or namespace Math { class Vector { } } I'd like the first option, because it makes it simpler to have a Math::Vector class that is not from PEAR (for example) It will be easy to extend to other more nested cases, like: namespace PEAR:HTML:Template { class SuperDuperUltimate { } } Another question. Are we going to keep the '_' naming standard w/ namespaces?, i.e. would we use the naming of the class (e.g. in the first example) as 'Vector' or 'Math_Vector'? My instinct would be to use just the shorter form, as the qualification of the namespace should suffice, and as we cannot expect a package that has namespaces, etc. to run on PHP 4. The second form looks kludgy, e.g.: $w = new PEAR:Math::Vector(); vs. $w = new PEAR:Math::Math_Vector(); Ideas/opinions/pointers/rants? ===== --- Jesus M. Castagnetto (jcastagnetto@yahoo.com) Research: http://metallo.scripps.edu/ Personal: http://www.castagnetto.org/ __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - File online, calculators, forms, and more http://tax.yahoo.com

« previous php.pear.dev (#14865) next »