That's exactly how import w/ aliasing is supposed to be used, you got that perfectly right.

David



Am 23.07.2007 um 20:40 schrieb Markus Fischer:

-----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-----

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



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

Reply via email to