Re: Re: PEAR2 Coding standards, Autoloading and Namespaces
| From: | Michael Gauthier | Date: | Wed, 02 Apr 2008 14:42:31 +0000 |
| Subject: | Re: Re: PEAR2 Coding standards, Autoloading and Namespaces | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-49603@lists.php.net to get a copy of this message | ||
On Tue, 2008-01-04 at 23:56 -0700, Jeff Moore wrote:
> On Mar 29, 2008, at 3:13 PM, Greg Beaver wrote:
>
<snip>
> Since the goal of namespaces is to avoid naming collisions, I also
> think that each package should have one, since that seems to be the
> fundamental subdivision in PEAR. AFAIK there is no HTTP maintainer,
> so I am not sure that PEAR2::HTTP makes sense as a namespace for the
> HTTP_Request package. (Well, there is an HTTP package, but it looks
> like that may be a bit of legacy and does not have maintenance
> oversight over all the over all HTTP_ packages. Educate me if I am
> wrong.)
>
> So, I think I favor the two level namespace with PEAR2::Package_Name
> style.
> Jeff
>
>
I agree the contents of a package should be restricted to one namespace
but packages are also divided into categories. A three-level namespace
of PEAR2::[category]::[package] makes sense to me.
This would be PEAR2::Crypt::GPG for the GPG package and the fully
qualified class name of the GPG class would be PEAR2::Crypt::GPG::GPG.
This is the same as many Java packages. For example, java.applet.Applet,
javax.swing.border.Border. The only difference is they use lower-case
for package names.
Mike