2022-08-19 16:25:42 +12:00
|
|
|
use Any
|
|
|
|
use Boolean
|
2022-08-19 17:46:36 +12:00
|
|
|
use LogicalNot
|
2022-08-19 16:25:42 +12:00
|
|
|
|
2022-08-04 17:38:00 +12:00
|
|
|
```doc
|
|
|
|
# Equality
|
|
|
|
|
|
|
|
Values which wish to implement the `==` infix operator must implement this protocol.
|
|
|
|
```
|
2022-08-07 16:20:33 +12:00
|
|
|
protocol Equality, as: do
|
2022-08-04 17:38:00 +12:00
|
|
|
```doc
|
2022-08-19 17:46:36 +12:00
|
|
|
Compare `self` and `other`, returning `true` when the values are equal.
|
2022-08-04 17:38:00 +12:00
|
|
|
```
|
2022-08-07 16:20:33 +12:00
|
|
|
def equal?(self: Self, other: Any): Boolean
|
2022-08-19 17:46:36 +12:00
|
|
|
|
|
|
|
```doc
|
|
|
|
Compare `self` and `other`, returning `true` when the values are not equal.
|
|
|
|
```
|
|
|
|
def not_equal?(self: Self, other: Any): Boolean, as: LogicalNot.not(Equality.equal?(self, other))
|
2022-08-04 17:38:00 +12:00
|
|
|
end
|