Why does the spaceship operator have only one equal sign in it?
Why would it have two? There's only one in <=
, >=
and !=
. It's not inconsistent at all. Only ==
is inconsistent, and that's to avoid conflicts with the assignment operator.
The spaceship operator is a combination of a < b
, a == b
, and a > b
. Presumably, the single equals sign was chosen for the same reason it was chosen for >=
and <=
-- it's simply shorter and easier to read.