Re: Question about Namespace patch

From: Date: Mon, 23 Jul 2007 17:32:13 +0000
Subject: Re: Question about Namespace patch
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-31217@lists.php.net to get a copy of this message
Once again. I do not want classes/function from ORM lib to clutter my global namespace everywhere. I just want everything from it to be available in couple of files (where lots of SQL/mapping) is going to be used. In those few files I'll be able to keep control of names and avoid conflicts. Sure, I can prefix all the names or insert a bunch of imports, although it'll just be ugly.
Maybe if you use a really hairy ORM with a real lot of levels with real lot of namespaces on each level which you all need it might be a bit ugly. It's the same in other languages too - Java and Python code is no stranger to a bunch of imports at the start of the file. And BTW if you have such library structure blanket imports won't help you either since you'd have to do a bunch of imports to capture all the levels.
If using a bunch of imports is the only way that is accepted - then at least a shortcut like python's "from x import a,b,c,d,e,f,g,h" would be a nice.
Supporting comma syntax to group imports is probably a good idea, should hurt anything. As for supporting "from X import A, B, C" - I guess this is to mean "import X::A, X::B, X::C" - we need to think about it. Anyway, there's always an option of just using X::A, X::B and X::C - remember, putting things in global space is not a requirement, prefix is OK. What is not OK is a overly long prefix. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com

« previous php.internals (#31217) next »