On Sun, Aug 8, 2021 at 9:52 AM Rowan Tommins <rowan.coll...@gmail.com> wrote:
> > Yes, and as I demonstrated, there are situations where some of the > operators are only meaningful for a subset of operands. Saying that a > Money object is "Multipliable" would also be "a lie", since multiplying > two Money objects together is a logic error, even though multiplying > Money by a unit-less number is very useful. > > This is a good point, and your example of currency was a great example of a whole class of other things that would benefit: unit based values. I've started to work on the RFC document to collect some of the information we've discussed in this thread. I do not have the ability to edit wiki.php.net, so I cannot put the RFC on there at the moment. In lieu of that, I've created a placeholder markdown document on github for the RFC page: https://github.com/JordanRL/operator-overloading-rfc/ This is not where I will work on the implementation (which will obviously be on a fork of php-src). I've outlined my rough idea of the implementation I'm leaning towards in this doc, but have left out any discussion about interfaces for now, as I feel that's something that could use further discussion. Any feedback would be appreciated at this early stage. Jordan