On 23-10-2023 18:34, Larry Garfield wrote:
Jordan's RFC explained in detail why interfaces are not viable, which is why we have to use magic methods (with or without a special keyword) instead: https://wiki.php.net/rfc/user_defined_operator_overloads#why_not_interfaces (Seriously, it has an extensive FAQ. It's one of the more detailed and supported RFCs we've seen.)
Yes, I know the RFC, it's a great piece of work! The use of interfaces as mentioned in this RFC is however completely different from what Pierre and I are talking about. If I understand Pierre correctly, that is. The suggestion to include interfaces simply meant to allow freedom of choice. Choice between using an operator (`==`) or calling the equivalent method on the object (`->equals()`). That may get more people on board with operator overloading.
Regards, Dik -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php