Re: merging Controversial changes back into PEAR2 Standards
| From: | Travis Swicegood | Date: | Sun, 23 Sep 2007 20:20:12 +0000 |
| Subject: | Re: merging Controversial changes back into PEAR2 Standards | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-48132@lists.php.net to get a copy of this message | ||
On Sep 23, 2007, at 12:22 PM, Gregory Beaver wrote:
What I think is unclear is the meaning of "dependency" as I used it. I'm referring to external classes - classes declared in other files. By this definition, even PEAR2::Package::Exception is an external dependency. The only alternative to proposal #3 (using import) is that we mandate that all classnames must be used in their entirety, i.e.: throw new ::PEAR2::Package::Exception('blah'); and that import must be avoided inside PEAR2 packages. This is an option, I find it rather unattractive, but it is an option.Aside from aesthetics, do you have any other issue with it? And how do we handle name clashes? Example: <?php import PackageOne namespace PackageTwo class SomeObject { public function doSomething() { $obj = new FooBar(); // PackageOne::FooBar $driver = new Driver(); } } class Driver { } ?> Now, what happens when there's PackageOne::Driver in addition to PackageTwo::Driver? The routes as I see them are: 1. Uses PackageTwo::Driver as SomeObject is within PackageTwo. 2. Uses PackageOne::Driver as it was declared first 3. Never runs as class Driver caused a fatal error Part of the benefit of namespaces/packages is that you can keep object names extremely generic without worrying about name collisions. Having two Driver, Abstract, Parser, etc., etc. classes in different packages will not be that unlikely. If we import a package into the current scope we have to worry about clashes, no? All that said,I think its too early in the release cycle of PHP to be adding speculative features. Until there's at least a beta PHP 5.3 release, what ends up in the actual release is up in the air with how it behaves is even more so. -Travis