Re: Question about Namespace patch
| From: | Markus Fischer | Date: | Mon, 23 Jul 2007 18:40:19 +0000 |
| Subject: | Re: Question about Namespace patch | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-31223@lists.php.net to get a copy of this message | ||
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Andrew,
Andrew Minerd wrote:
> Well, first of all, not exactly. I think you meant: not import everything from two or more
> namespaces with conflicting names. Secondly, that's not the only solution. You could import
> everything from one, and not import from the other (or use a shorter prefix). Thirdly, you're
> not preventing collisions _at all_:
>
> import Zend::DB;
> import My::DB;
> import Woot::Database as DB;
I don't quite understand your example. When I look at it in real life, I
would go for:
import Zend::DB as ZBD;
import My::DB as MDB;
import Woot::Database as DB;
I mean, that's is the point, to have more readable code == shorter
identifiers, isn't it?
So your code continues to read (just made up):
$oZdb = ZDB::factor('mysql');
$oMdb = MDB::getInstance('oracle');
$oWdb = DB::getDriver('postgres');
instead of:
$oZdb = Zend::DB:factor...
$oMdb = My::DB::getInstance
$oWdb = Woot::Database::getDriver..
Isn't that a win, at last?
That's how I understood. Maybe I got that wrong.
- - Markus
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGpPYT1nS0RcInK9ARAmQmAKDGsYj/ZY0FNojQobKb3bK2NL6QDgCcDKgl
LnyIP65ymnx180f7/WD5WfM=
=LjpG
-----END PGP SIGNATURE-----