Hi!

for the same reason you would want it with classes?? because you can
do it with classes, no? and that seems acceptable to you, no? then functions
should have the same privilege.

Functions and classes are rather different things. Class represents, as you know, group of data and behavior, function is much smaller. You have maybe two dozens of built-in classes in PHP that reside in global space, and many of them (like SPL) can be moved out relatively easily to own namespaces. You have hundreds, if not thousands, of internal functions, most of them can't be moved anywhere. So having functions imported into global space is much less useful and much more dangerous than the same for classes. It is also much less useful from one more perspective - when you import a class, you get a bunch of functions which represent functionality unit. With single function you probably get only a small piece, so if you use a library you probably have dozens of functions there. If you think importing all of them into global space through "use" is a good idea, I think you need to do some refactoring there. It would grow to be unmaintainable rather fast. I'd recommend putting them into a namespace (if for some reason you have classes) and then just use Utility::func() - it's really not that bad.
--
Stanislav Malyshev, Zend Software Architect
[EMAIL PROTECTED]   http://www.zend.com/
(408)253-8829   MSN: [EMAIL PROTECTED]

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

Reply via email to