Hi!

> This seems to be the core of your argumentation in this thread: "Why
> don't you just use Foo::bar() instead of foo\bar()?"
> 
> In which case, I wonder why we have functions at all. We could just use
> static methods instead after all. Maybe we should deprecate function
> support?

Maybe we should stop strawman arguments? I never claimed functions
should be replaced with static methods or that we should deprecate
anything, please don't put words in my mouth.
What I claimed is that if you write code in a *specific pattern*, that
is the only pattern that makes this proposal useful and that is, as far
as I can see, in no way common among people that use functions, then *in
this specific case* you could as well use slightly different pattern
which would allow you to use existing facilities, and the only
difference between the two is the word "class" and using :: instead of \.

> On a more serious note: If you want an actual example of how functions
> can be easier to use than static methods, consider the "use function"
> RFC. Now that it's in, it is possible to directly import a function
> foo\bar() and use it with just bar(). Static methods allow no such
> thing. You always need to write the class name.

Which is a good thing. Making different thing mean the same is not a
good idea, it reduces readability. And typing 2 characters less was
never a priority.

> The reason why people currently resort to using static methods instead
> of functions is the fact that there is no autoloading for functions.
> With autoloading, functions become a lot easier to use.

I don't accept this "resort to" - static functions is not something that
one should "resort to", it is a completely valid syntactic construct.
-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

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

Reply via email to