@@ -80,7 +80,7 @@ property that values of type `T` can be compared to values of type
80
80
81
81
trait Eq[-T, -U]
82
82
83
- That is, ` Eq ` is a pure marker trait two type parameters and without
83
+ That is, ` Eq ` is a pure marker trait with two type parameters and without
84
84
any members. Developers can define equality classes by giving
85
85
implicit ` Eq ` instances. Here is a simple one:
86
86
@@ -124,10 +124,10 @@ Details are explained in the
124
124
125
125
Here are some nice properties of the proposal
126
126
127
- 1 . It is _ opt-in_ . To get safe checking, developers have to annotate classes that should
128
- allow comparisons only between their instances with ` @equalityClass ` , or they have to define implicit
127
+ 1 . It is _ opt-in_ . To get safe checking, developers have to annotate with ` @equalityClass ` classes that should
128
+ allow comparisons only between their instances, or they have to define implicit
129
129
` Eq ` instances by hand.
130
- 2 . It is backwards compatible. Without ` @equalityClass ` annotations equality works as before.
130
+ 2 . It is backwards compatible. Without developer-provided ` Eq ` instances, equality works as before.
131
131
3 . It carries no run-time cost compared to universal equality. Indeed the run-time behavior of
132
132
equality is not affected at all.
133
133
4 . It has no problems with parametricity, variance, or bottom types.
@@ -139,11 +139,9 @@ The scheme effectively leads to a partition of the former universe of
139
139
types into sets of types. Values with types in the same partition can
140
140
be compared among themselves but values with types in different
141
141
partitions cannot.
142
-
143
142
An ` @equalityClass ` annotation on a type creates a new partition. All
144
143
types that do not have any ` Eq ` instances (except ` eqAny ` , that is)
145
144
form together another partition.
146
-
147
145
So instead of a single _ universe_ of values that can be compared to
148
146
each other we get a _ multiverse_ of partitions. Hence the name of the
149
147
proposal: ** Multiversal Equality** .
0 commit comments