Closed chris-kruining closed 6 years ago
I just tried to see how doable it would be on preprocessing time, but this sort of things really needs runtime support.
I'd love to see this RFC moving forward: https://wiki.php.net/rfc/operator-overloading
agreed, although I'm not sure on the 'magic method syntax'. on the other hand if we got getter and setter syntax like es6 then on many an occasion operators like += would be handler quite nicely IMHO
As suggested here I create this to discus ideas.
I would like to see an operator overloading feature, where I might overload for example the + operator.
This would then translate to
+= would be its own operator. and maybe a more advanced way would be that the use case of the + would determine which method would be called based on method signature, that is
Would become
I would like to emphasize that I'm just throwing out ideas, I have no concrete idea of how the implementation would be done