2 ms·
I personally find this one-liner mentally difficult to parse in a glance. Yes, I can fully understand what it's actually doing, but when I glance at the code I
by lsaferite 7y ago
I personally find this one-liner mentally difficult to parse in a glance. Yes, I can fully understand what it's actually doing, but when I glance at the code I have to focus on it too long before I am sure of what it is doing.
For better or worse, I operate mainly in the PHP world and the recently added spaceship operator is a solution to this. While I think it's a crazy operator on the one hand, on the other it's much simpler to use.
https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.spaceship-op https://www.php.net/manual/en/migration70.new-features.php#m...
return a <=> b;
EDIT: fixing typos