Intervals.jl icon indicating copy to clipboard operation
Intervals.jl copied to clipboard

Remove (or rename) `HE` and `HB`

Open nickrobinson251 opened this issue 4 years ago • 6 comments

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.

nickrobinson251 avatar Jun 11 '20 17:06 nickrobinson251

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.

iamed2 avatar Jun 11 '20 18:06 iamed2

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

nickrobinson251 avatar Jun 12 '20 13:06 nickrobinson251

Wow, yes, that's confusing. That should absolutely be changed.

iamed2 avatar Jun 17 '20 13:06 iamed2

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.

clarkevans avatar Jul 25 '20 02:07 clarkevans

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?

mzgubic avatar Aug 14 '20 11:08 mzgubic

I think we probably want to deprecate them, and only later remove them e.g. for now @deprecate HE HourEnding(ceil(anchor, Hour))

nickrobinson251 avatar Aug 14 '20 11:08 nickrobinson251