> It is clear to me that there are valid reasons to say yes to this proposal,
> but there are a lot to say no too.
> Even if it could be interesting in theory, due to of how PHP handles
> collisions between classes and functions names (no check at all),
> implementing a callable class could break existing code.
>
> At the moment a class and a function with the same name can coexist,
> but implementing a callable class would mess this state of affairs.
> With the adoption of the namespaces, I think that this collisions could
> became
> so rare to not exist, but of course we cannot ignore pre existing
> situations.
>
> As suggested by Patrick Schaaf, a workaround is to implement a function,
> with
> the same name of the class, that behaves like a wrapper for a method call.
> It is a good point, but has the negative side that it must be implemented
> for every
> class who follow this pattern. It is not usable in a framework for example.
>
> It seams that to handle consistently a callable class is to modify PHP
> to treat functions/classes names case sensitive and to trigger an
> E_WARNING (or similar) in case of collision.
> In this way new code could take advantage of the new syntax and old code
> could simply suppress the warning.
>
> What do you think?


This change might be disastrous in some applications, and I don't think it
will be worth it just for the sake of some syntactic sugar.
And still this change won't even make a difference if you have a class and
function with the same name that E.G uses all lowercase.

Reply via email to