If you use that Vendor1 lib in one.php file a lot you clutter your code with
Vendor1::A, Vendor1::B, Vendor1::C, etc. It is possible to rename Vendor1
to something shorter using import but you still have to prefix it.

I see no problem with Vendor1::A, it's not overly long. When you have Vendor1::A::B::C::D::E then it's long, but you can shorten that. Of course, if you use many different sets with very narrow cross-section it may mean you'd have still to use long names or have a bunch of imports, but putting everything into global space in no way would solve the problem - as I mentioned, good names run out pretty fast, and blanket import means you can never use a plain English word to name any class in your application - because there's a high probability that somebody else would use the same word and thus your library becomes incompatible with his once both are imported. That is on top of a myriad of technical problems that blanket imports bring (think complete impossibility of compile-time name resolution and the trouble of maintaining separate per-file global scopes). Also, having a bunch of imports is not that bad if you use a tool - like an IDE - to assist with it.

That's why people sometimes want to import *all* names from namespace.

I understand why they may want this, but implementing such functionalities opens a very large can of very nasty worms - since libraries start being import-incompatible and then people start making names like Vendor1_Module_Submodule_Exception all over again just to allow their library to be imported with other library.
--
Stanislav Malyshev, Zend Software Architect
[EMAIL PROTECTED]   http://www.zend.com/
(408)253-8829   MSN: [EMAIL PROTECTED]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to