On 15 February 2020 22:05:52 GMT+00:00, jan.h.boeh...@gmx.de wrote:
>Some discussion points, I can think of, would be the naming of the
>methods
>(maybe naming them after the operator symbol and not the arithmetical
>operation they represent, e.g. __plus instead of __add) or putting the
>methods inside of interfaces like done for ArrayAccess


As I mentioned earlier [1] I think the answers to both of these questions 
depend on a fundamental philosophical question about what you're overloading:

- The groups of operations which exist for built-in types e.g. the arithmetic 
operations overloaded by GMP; or string operations overloaded by an object with 
enhanced Unicode functionality.

- The individual symbolic operators, with no intrinsic meaning - e.g. 
overloading . for concatenation on strings but dot-product for vectors; or a 
DSL overloading << and >> for "into" and "out of".

I think it would benefit the RFC to take a stance on that question, and build 
the feature around it.


[1] https://news-web.php.net/php.internals/108347

-- 
Rowan Tommins
[IMSoP]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to