Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How many time constants could possibly be in their code base? A few dozen?

Instead of writing `foo(3.days)` they are writing `foo(T_3_DAYS)` with this library. Instead, why not just create a constant `BAR_DURATION = 3.days.in_seconds` and then write `foo(BAR_DURATION)`.

Problem solved.



You can still assign these values to semantically-named variables where appropriate, with the bonus of not having to monkey-patch ints just to define a few dozen constants.

It's benign, boring utility code, I just don't get what's offensive about it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: