On 03/01/2016 02:14, Sara Golemon wrote:
Patricio Tarantino has asked me to help him propose Operator
Overloading in PHP 7.1 (based in part on my operator extension in
PECL). I think we can expose this to usespace as magic methods with
very little overhead (the runtime check and dispatch is already there,
after all).
https://wiki.php.net/rfc/operator-overloading
It's something I'd love to see, and would be particularly useful for my
Complex Number and Matrix libraries, but (as Bishop says) the large list
of magic methods does feel excessive, and a single dispatcher method
feels simpler.
But how then would it be possible to overload several operators? If the
__overload() dispatcher method has to implement a switch on the value of
the operator argument, and implement error handling for invalid or
non-implemented operators, it's pushing a lot of complexity into that
magic method
--
Mark Baker
_________
|. \ \-3
|_J_/ PHP |
|| | __ |
|| |m| |m|
I LOVE PHP
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php