Re: [VOTE] User Defined Operator Overloads
| From: | Pierre | Date: | Mon, 03 Jan 2022 17:02:26 +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-116781@lists.php.net to get a copy of this message | ||
Le 03/01/2022 à 17:12, Larry Garfield a écrit :
On Mon, Jan 3, 2022, at 9:52 AM, Pierre wrote:I think you read it too quickly. Anyway it was just examples, my point is not specifically about generics, but about the fact that operator overloading has been hugely controversial, and independently of the fact that I think this is a very well documented RFC, I still don't like it and express my opinion, I probably would not use those, but I eventually will be step debugging into some, and god, I don't wish I'll have to, really, I hate magic and non verbose code. Nevertheless, I have to admit, if I had the right to vote, I would abstain because it still a feature a lot of people want. Best regards, -- PierreI personally tend to agree with everything that Marco said. Especially regarding the fact that it's adding huge complexity to the language itself for mostly edge cases. I'd argue there's many much more valuable features that could be added to PHP before operator overload, such as generics, rationalized collection API and scalar objects with methods for example (which all could be magnificent tools for improving the operator overload RFC).Those are all independent of operator overloading. There's zero reason one needs to come before/after any other. Everyone wants generics, but they're really hard or Nikita would have implemented them already. This is a non-argument. 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.