Lester Caine wrote:
What would be the advantage of wrapping legacy functions in a
namespace over wrapping them into a class as static functions?
THAT is probably why I am asking the question? And may well be key to
my understanding why converting non OO code into OO code in PHP is so
problematic. When I was coding in CC++ more heavily libraries did not
need to be objects and the 'namespace' just wrapped the code OR the
code was built as an object. That is what I understand by a namespace,
so perhaps I do not understand why leaving out functions and constants
is acceptable :(
I don't think there's any difference between moving non OO functions to
a class and making the static and moving those to a namespace (in a
suggested syntax it would be: Bar:::foo() for a namespace and Bar::foo()
already for a class). Even more, I think there are advantages for moving
a legacy app to a class because it allows you to make your global
variables (like things in legacy apps) class members. Of course that's
only an advantage if you agree that globals are evil...
So my conclusion would be that leaving out functions and constants is
acceptable because there's no advantage of having those in a namespace.
Classes already provide everything you would possibly want from
namespaces for functions and constants.
Ron
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php