Open ericphanson opened 2 years ago
There is a potential alternate behavior of the TimeSpans interface for Period
s that I think could arguably make more sense: start(period)
is 0 and duration(period) == period
. I have on at least one occasion forgotten about the one-nanosecond behavior and thought it worked this way. I think it would actually make your two time_from_index
examples behave identically.
I think that kinda makes sense, but the ambiguity seems like a good argument that these should be MethodError
's instead, so you have to specify
https://github.com/beacon-biosignals/TimeSpans.jl/blob/eb327966a96776b1b5f9980ad18e3719930d8279/src/TimeSpans.jl#L105-L119
I get that it's so that TimePeriod's act like a 1-ns range around that time, but I think it's overly error prone. E.g.
gives 1 Nanosecond always, where the intended code is
IMO in this case a clear error from the first example would be preferable.