Re: [VOTE] Userspace operator overloading
| From: | Mark Randall | Date: | Tue, 24 Mar 2020 11:14:28 +0000 |
| Subject: | Re: [VOTE] Userspace operator overloading | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-109268@lists.php.net to get a copy of this message | ||
On 23/03/2020 17:58, jan.h.boehmer@gmx.de wrote:
I have opened voting on https://wiki.php.net/rfc/userspace_operator_overloading, which allows users to overload operators in their own classes.I am certainly not opposed to operator overloading, and would like to see it in the language. However, I'll be voting no because of a couple of implementation points: 1. I feel like the choice of NULL as the return type for not implemented is far from ideal, especially for 8.0 which provides for union type hints. 2. The error handling behaviour is too timid. If operator overloading is to become a first-class feature, error handling should reflect as such and any attempt to use objects without the appropriate handlers being installed really should result in an error being thrown just as it would be if an undefined method was called. Mark Randall