Re: Make sorting stable

From: Date: Wed, 11 Mar 2020 05:06:42 +0000
Subject: Re: Make sorting stable
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-108967@lists.php.net to get a copy of this message
Hi! > Given that we have internal classes which deliberately have such > comparison behavior (i.e. returning 0 or 1, to signal that there is no > order defined), e.g. Closures[1], I tend to prefer raising a warning > instead of trying to recover. I think there weirdness is because equality and comparison are mixed. Equality can be defined for almost every object, but comaprison makes sense for much smaller set of objects. So I wonder maybe a good solution would be to somehow separate the two. And then maybe raise an exception when trying to compare objects that can't be compared? -- Stas Malyshev smalyshev@gmail.com

« previous php.internals (#108967) next »