Re: YANP (Yet Another Namespace Proposal)

From: Date: Fri, 08 Jul 2005 23:00:09 +0000
Subject: Re: YANP (Yet Another Namespace Proposal)
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-17200@lists.php.net to get a copy of this message
JH>>With the above scenario, nothing will be affected if there is an JH>>opcode cache or not. The only situation I can think of where an opcode JH>>cache can affect this is when the script DYNAMICALLY creates classes JH>>from the imported namespace. Maybe there's other situations, but I JH>>can't come up with any at the moment. No, more simple - somebody removes one of the classes. Even if nothing in your code ever used it, you'd start getting errors about missing files. JH>>Either way, I'm not sure if full namespace imports are a good idea anyways. Without this, only thing you are achieving with imports is saving a couple of keystrokes. If you have to declare each imported class anyway, why not name it by the full name? Just saving a dozen of keystrokes (which any good code-completing editor would save anyway) and one require statement is not worth the trouble, IMHO. JH>>Issues like the one you presented are one reason, and the other is that it JH>>is bad practice. If multiple namespaces are imported, readability is JH>>affected (which class belongs to which namespace?). Also, if two namespaces That's a general problem with all namespace imports. JH>>are imported, and one day a new class is added to one which has the same JH>>name as another, then there will suddenly be a compile error, and the error JH>>will be elusive. Right, that's one more problem with namespace imports. -- Stanislav Malyshev, Zend Products Engineer stas@zend.com http://www.zend.com/ +972-3-6139665 ext.115

« previous php.internals (#17200) next »