outrun/outrun-core/lib/equality.outrun

21 lines
503 B
Text
Raw Normal View History

2022-08-19 16:25:42 +12:00
use Any
use Boolean
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.
```
protocol Equality, as: do
2022-08-04 17:38:00 +12:00
```doc
Compare `self` and `other`, returning `true` when the values are equal.
2022-08-04 17:38:00 +12:00
```
def equal?(self: Self, other: Any): Boolean
```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