On Sun, Sep 15, 2024 at 12:52 AM Jordan LeDoux <jordan.led...@gmail.com>
wrote:

>
> These changes could and should be provided independent of operator
> overloads. Gina has been working on a separate RFC which would cover all
> three of these issues. You can view the work-in-progress on that RFC here:
> https://github.com/Girgias/php-rfcs/blob/master/comparison-equality-semantics.md
>
>
Unrelated topic, sorry for the spam.
I just wanted to point out that interface default methods will play nicely
with the mentioned interfaces: Equatable and Comparable:



interface Equatable {
    public function equals(mixed $other): bool;
}
interface Comparable extends Equatable {
    public function compare(mixed $other): int;
    public function equals(mixed $other): bool {
        return $this->compare($other) === 0;
    }
}


So that it signals a clear intent of: "what is comparable is also
equatable, and this is the default implementation for it.

Alex

Reply via email to