Intervals.jl
Intervals.jl copied to clipboard
Remove (or rename) `HE` and `HB`
They're pretty mysterious:
- The methods have surprising behaviour
- The names are not descriptive names
- The names don't follow any usual naming/style conventions
I personally find reading code that uses HE
very confusing, especially if HourEnding
is also used.
To be fair, i'm not sure what unsuprising behaviour would be from things named HE
and HB
.
If rounding to the nearest hour needs a nicer interface, i think we can do better than HE
and HB
.
p.s. As a historical note, I've been confused by HE
and HB
, and their description as "pseudoconstructors", since my very first month at Invenia.
I think we used to use the terms "hour-ending" and "hour-beginning" so often that it was obvious what "HE" meant to most people. Now we have many more people and we use that term less often. I don't think it really provides any benefit beyond making code shorter and clearly has more prominent downsides.
To be fair, if these were
const HE = HourEnding
const HB = HourBeginning
I could be onboard with them... but they are not that, as they also ceil
/floor
their input, which is why I think they're particularly confusing
https://github.com/invenia/Intervals.jl/blob/d7a27c3e9d6f78ee190f88a7a1337b64d5a2aa4e/src/anchoredinterval.jl#L143
Wow, yes, that's confusing. That should absolutely be changed.
This is a great library. Thank you for writing it. I agree with this ticket; and further comment... HourEnding
and HourBeginning
also seem quite application specific. Their definitions could be moved to the example, which might be fun/clever.
Do we want to delete these from the package completely or deprecate them? I guess removing it can be annoying for someone using HE and wanting to use a new feature in a future 2.1.0 release?
I think we probably want to deprecate them, and only later remove them
e.g. for now @deprecate HE HourEnding(ceil(anchor, Hour))