Re: [Pre-RFC Discussion] User Defined Operator Overloads (again)

From: Date: Mon, 16 Sep 2024 17:58:05 +0000
Subject: Re: [Pre-RFC Discussion] User Defined Operator Overloads (again)
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-125570@lists.php.net to get a copy of this message
On Mon, Sep 16, 2024 at 6:08 AM Rob Landers <rob@bottled.codes> wrote: > On Mon, Sep 16, 2024, at 09:47, Jordan LeDoux wrote: > > The reason for this was to prevent developers from creating situations > where 5 > $foo is true and 5 < > $foo is true. > > > Just to point out: currently, PHP already does nonsensical comparisons: > > https://3v4l.org/BZfc8 > > Granted, it is 'technically' correct that ($a <= $b || $b <= $a) === > false; but this really should be an error IMHO instead of a non-logical > result. > > — Rob > Yes, the default comparisons for objects is a little strange. This should be helped by Gina's RFC which I mentioned in my original email. The main issue is that at the moment Equatable and Orderable are inseparable within the PHP engine. Jordan

« previous php.internals (#125570) next »