Hi,
Am 14.08.2011 23:06, schrieb Stas Malyshev:
Hi!
On 8/14/11 1:39 PM, Sebastian Krebs wrote:
Counterquestion: Why shouldn't I use functions? They exists, they are
Because if you want to use functions of similar nature organized in a
package, that's what classes are used for.
When I must use classes are for packaging functions (that aren't
functions anymore, when I make methods out of them), what are namespaces
for? I'm just curious ^^
You want to do something that
goes contrary to how language is designed and then you want language to
change to fit your wrong usage. I don't see how it's good for the language.
I just want to use functions. Whats wrong with that? Really: Thats all.
discussed to get removed at all. It feels a little bit weird to me, that
I need to explain, why one wants to use functions, that are part of the
Please don't distort my words - nobody asked you why you need to use
functions in general. I asked why you don't use mechanisms for grouping
functions that exist in the language and work just fine with existing
semantics and instead want new semantics that has its own problems.
Its not (only) about grouping functions, its about using custom
functions at all. Grouping things is always a good idea and with
namespaces (not classes) it is already possible in a very clean and easy
way. There is no need to misuse OOP for that. As far as I can see there
is absolutely nothing new here. That functions/constants should be
covered by autoloading is the only thing I would like to see in one
future release.
language since ever. And (on the other hand) static methods are imo just
something different.
How different?
Static methods are (static) methods and functions are functions. Classes
can get extended [1] and have a state and such. In short: Both methods
and functions come from two different paradigms (OOP and
procedural/functional). Just saying "static methods are just grouped
functions" is a little bit to less and will always feel like a hack to
me. PHP calls itself "multiparadigm", but the prodecural part feels very
neglected over the time.
Regards,
Sebastian
[1] Yes, I know, I can mark a class as "final", but this keyword is imo
the most useless keyword ever ;)
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php