>On 9/11/06, Terje Slettebø <[EMAIL PROTECTED]> wrote: >> Please, people: The availability of free (non-member) functions in PHP (as >> in C/C++) is one advantage it has over Java, where everything _has_ to be a >> class. So in Java, instead of being able to write "sqrt(<number>)", you have >> to write "Math::sqrt(<number>)". Always.
>Actually, Java recently added static import to deal with that very >annoyance.... ;) Right. Well, to me, having to wrap everything in a class, just because you don't have free functions, seems like more of a workaround than anything else, and the static import a "kludge" to make that less inconvenient (conceptually, it doesn't make a lot of sense to me to "import" some class's static members into a context...). Besides, it forces you to define everything in _one_ file (unless _that_ has been changed, as well). I'm reminded of that, after having learned Java at college, and taking up C++ again, after it, I had to "deprogram" myself of "Javaisms": I tended to use a class for everything, even if it made my design more complex and tighter coupled than necessary. For example, if I needed some functions that didn't naturally belong in a class (such as various "utility functions"), I'd wrap them as static members in a class called "Utility". When reading up on C++, again, I realised that this was absolutely not necessary: You could simply define them as free functions in a namespace called "utility"... That way, they may be called unqualified (if "imported" with "using"), and may span several files. Regards, Terje -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php