> Hi, > > Le Mon, 18 Mar 2013 09:07:43 +0200, Matīss Roberts Treinis a écrit : > > Not only that. This potentially might break compatibility with many > > software products already out there. > > I don't see how it could break existing software as it is not a > modification of an existing method but a brand new one. >
It would break existing software if you have a class and function with the same name. Consider the following example: class foo { } function foo() { } Now what if you have several calls to foo() in your existing application? With the new change, will those calls call the function, or invoke the __invokeStatic method if it is available? > > > Also, this might lead to many > > misunderstandings and, in fact, ambiguous code. Consider the sample. > > > > $name = 'something'; > > $something = $name(); // What is this - a function call or object? > > > > Fact is, we can not know that unless a) do a search in code b) var_dump? > > As long as you use syntax like $foo = new $bar() or $foo = $bar(), you'll > always wonder if the function/class behind $bar exist or not, etc... > And it is easy to remove any ambiguity by using $something = $functionName > () or $something = $className() or add proper comments. It's only up to > the dev. > > I find that __invokeStatic() could be a quite cool syntactic sugar. > > My 2 cents. > > Bruno I'm not against the function, just the implementation of it. __invokeStatic might be useful in some (rare) cases, but I don't think the proposed syntax will work. Also I'm sure that most use cases can anyway be solved by using the __callStatic method