There is no way to compare value type instances for equality, e.g.
val type VT {
x: int64,
}
func main() ret int32 {
let v1 = alloc VT{x:1};
let v2 = alloc VT{x:2};
let eq = v1 == v2;
let t1 = {1,2,3};
let t2 = {3,4,5};
let eq = t2 == t1;
return 0;
}
the comparisons will fail:
error: type mismatch in expression
┌─ test.cpm:23:14
│
23 │ let eq = v1 == v2;
│ ^^^^^^^^
error: invalid expression
┌─ test.cpm:23:14
│
23 │ let eq = v1 == v2;
│ ^^^^^^^^
error: type mismatch in expression
┌─ test.cpm:28:14
│
28 │ let eq = t2 == t1;
│ ^^^^^^^^
error: invalid expression
┌─ test.cpm:28:14
│
28 │ let eq = t2 == t1;
│ ^^^^^^^^
There is no definition of equality for value types, either implicit by bitwise comparison or explicit by user defined comparator
There is no way to compare value type instances for equality, e.g.
the comparisons will fail:
There is no definition of equality for value types, either implicit by bitwise comparison or explicit by user defined comparator