On 19.04.2013 08:19, Stas Malyshev wrote:
Hi!
One of the shortcomings of namespaced functions in PHP is that it is
not possible to import them as you can do with classes and
namespaces. For code that is not in the same namespace as the
function, you must always reference at least one part of the
namespace in order to call it.
What's wrong with referencing one part of it? It can be as short as two
characters, and an an added bonus you won't suddenly have your strlen
overridden by somebody without you knowing it. Functions live in global
space, and there's a real lot of them, that's why importing them wasn't
considered a good idea - it's going back to the same problem we were
escaping with namespaces.
Saving two keystrokes while sacrificing clarity is usually not the best
idea.
I don't know about your libraries but mine use longer namespace parts
then 2 charakters.
And strlen wouldn't be "suddenly" overridden because you would have to
explicitly import it, so this argument could be used for namespaces too
because if I "use some\ns\DateTime" DateTime is "suddenly" overridden.
--
Christoph Rosse
Softwaredevelopment | Operations
________________________________________
2bePUBLISHED Internet Services Austria GmbH
Brünner Straße 85/2, 1210 Wien
Tel.: 0043.1.9971500
Fax.: 0043.1.997150066
E-mail: cro...@2bepublished.at
Skype: christoph.rosse
Home: http://www.2bepublished.at
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php