Re: [VOTE] User Defined Operator Overloads

From: Date: Mon, 03 Jan 2022 17:07:11 +0000
Subject: Re: [VOTE] User Defined Operator Overloads
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-116783@lists.php.net to get a copy of this message
Le 03/01/2022 à 17:12, Larry Garfield a écrit :
Also, people keep talking about edge cases. In my experience, "are these two objects equal" (for some object-specific definition of equal) is very much *not* an edge case. I may have less use for overloading % as I don't use advanced math that much, but I compare things all the frickin' time and that would be incredibly useful day to day.
I forgot to answer to that, specifically. I'd much more prefer to have an explicit equals(object $other): bool (magic or not, really I do not care) single method for equality only, that'd be great. In that sense, I much preferred specific RFC about __equalsTo() or __compareTo() alone that a huge generic operator overload RFC. I think both could actually be separated, it wouldn't be that weird. Best regards, -- Pierre

« previous php.internals (#116783) next »