17255, "mppf", "can we extend comparisons to none to allow other types?", "2021-02-24T21:09:50Z"
Consider this example, which I wrote without really thinking about it when updating something else:
var x: int;
if x == none {
writeln("it is none");
} else {
writeln("it is not none");
}
It results in a type error because we can't compare none
and int
.
However since none
is the only value of the type nothing
, it seems to me that any value of any type other than nothing
(note 1) should compare as not equal.
note 1: any type other than nothing
or potentially dtAny
if it is possible to get at that in user code.