Re: [Pre-RFC Discussion] User Defined Operator Overloads (again)
| From: | Christoph M. Becker | Date: | Fri, 20 Sep 2024 14:09:22 +0000 |
| Subject: | Re: [Pre-RFC Discussion] User Defined Operator Overloads (again) | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-125642@lists.php.net to get a copy of this message | ||
On 20.09.2024 at 15:00, Gina P. Banyard wrote:
> This leads to a rather insane situation where the engine does not assume + is always
> commutative but does so for *, something which makes no sense as multiplication or product
> operations are (in the grand scheme of mathematics) rarely commutative.
Gosh, I had completely forgotten about ZEND_TRY_BINARY_OBJECT_OPERATION.
So I withdraw my statement about the only reasonable way to implement
operator overloading in PHP[1], and state that there is no reasonable
way to implement operator overloading in PHP at all (excluding
comparison and equality operations), since apparently, we cannot even
get the *only two* internal bundled classes to properly handle this.
Cf. <https://3v4l.org/gksqI/rfc#vgit.master> and
<https://3v4l.org/o5Uhh/rfc#vgit.master>.
[1] <https://externals.io/message/125550#125621>
Christoph