How do I extend the datatype system

But what’s the use case where you would want to compare an arbitrary integer with an Epoch? While the data type of the underlying value is the same, the meaning behind them is different. It just doesn’t make sense to me to have it extend Int32 as you would now essentially be able to do like:

arr = [1, 2, 3]

pp arr[Epoch.new(1234)]

Since def [](index : Int) accepts any Int. This doesn’t make much sense.

What would be an example of what these custom functions would be doing? I just fail to see how this would be any better than just using already built in types like Time which would get you methods better suited for dealing with instances in time than an arbitrary integer.

E.x.

class Foo
  property x : Time = Time.unix 1589831432
end