Re: Question about Namespace patch

From: Date: Mon, 23 Jul 2007 08:26:02 +0000
Subject: Re: Question about Namespace patch
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-31172@lists.php.net to get a copy of this message
Absolutely not the case. Take a look at C++, C#, even Python. The "namespaces" implementation of those languages is mostly consistent (even if Python doesn't call it that).
Come on, python modules are not like C++ namespaces at all. For starters, AFAIK, python doesn't even have namespace declaration operator. And module loading and namespacing are combined.
You're not helping developers at all with this implementation. If you're
How many developers did you ask, honestly? I had asked some, and they say it helps. Including on the list. You wanted to say I'm not helping some other developers? Well, too bad, there's no patch that can solve everybody's problems :)
working with a large library and have to import a lot of classes, the way this works is nothing but a pain. We would be better off not using namespaces at all, in this case. Thus, the problem has not been solved.
Once more, you DO NOT have to import a lot of classes. Please do read what I write. You SHOULD NOT import classes in global space. Namespaces are NOT the way to bring all classes in global space, and it should not be done.
Also, for the implementation to be complete, Core Developers and Extension Developers would need to namespace their classes / functions.
Not necessarily. So far PHP core & PECL has been OK without it, there's not too many classes and the names are quite manageable, unless I miss something.
but you still need to offer developers *some* way of importing everything out of a namespace. I absolutely will have upwards to close
No, I don't need that.
to 25 - 30 classes in a single namespace. And sometimes more. To be able to import them all is an absolute necessity for this implementation to
No, it is not an absolute necessity, actually it's exactly the opposite. You don't want each module to inject 30 new names into global space, because you'll be running out of names very, very fast.
the fact that I may be using OTHER libraries as well that may be namespaced. PEAR is a perfect example of this. Look at all the libraries that exist there. I would absolutely love to just: import PEAR; import PEAR::HTTP; import PEAR::Image;
Yeah, and not since you have generic PEAR exception class, HTTP exception class and image exception class, you've got three exception classes competing with system exception class for the name. Lovely. So now we get PEAR::PEAR_Exception to prevent that, right? So how it's better than just PEAR::Exception?
individual class that I need. And with all of the languages I mentioned before, that is *exactly* how it works. Of course, we're back to the
No, actually it doesn't. In python import - and that's what most use - doesn't bring names into global space.
namespacing of the PHP Core and Extensions. Which is really the main blocker to any serious namespaces implementation, beyond what's currently patched to HEAD today, correct?
No, incorrect. The main blocker was that all other implementations were either inconsistent, hurting performance or too complex for PHP. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com

« previous php.internals (#31172) next »