On Fri, Aug 30, 2013 at 7:10 PM, Stas Malyshev <smalys...@sugarcrm.com>wrote:
> Hi! > > > Well, static methods aren't the same as functions. > > The big difference being? > 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? 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. 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. Nikita