Quoting Stanislav Malyshev <[EMAIL PROTECTED]>:
<?php
namespace Test;
// explicitly tell PHP that we want Test::Exception to be autoloaded (in
essence)
import Test::Exception;
class Tester {
public function fail() {
throw new Exception();
}
}
?>
This is even better than requiring, and makes the intent very clear.
I don't think it decreases intuitiveness, on the contrary - from the
look of the code it is immediately clear which exception would be
used.
Except that it makes it unclear what happens in _other_ files, which
is even worse. Once you include the file above, any other file in the
Test:: namespace that throws an Exception will throw Test::Exception,
not Exception, even if it doesn't import Test::Exception.
I think it makes much more sense to import classes that are _outside_
the current namespace. Having to import pieces of your own namespace
makes namespaces less useful and intuitive.
-chuck
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php