| compare-to other/Comparable -> any | Compares this object to the other. |
|---|---|
| compare-to other/Comparable [--if-equal] -> any |
MyTime implements a lexicographical ordering of seconds and nanoseconds using compare-to other [--if-equal] to move on to nanoseconds when the seconds component is equal.
class MyTime:
seconds/int
nanoseconds/int
constructor .seconds .nanoseconds:
compare-to other/MyTime -> int:
return seconds.compare-to other.seconds --if-equal=:
nanoseconds.compare-to other.nanoseconds