Re:Why Not Comments
by gus_massa on Tuesday September 10, 2024 @08:15PM
(#41506985)
If I were forced not to write comments, I'd write that as
and let the compiler optimize that.
[ Parent
| on HN ]
When writing it inline, I like this approach. I like even better when these things have names. Something like `std.time.s_per_day` or `time_utils.s_per_day`. Then in the one place they're defined, use a pattern like the above to make them easy to reason about.
One step further:
DAY_IN_SECONDS = 24 * 60 * 60
Re:Why Not Comments
by throwaway14356 on Wednesday September 11, 2024 @11:48PM
(#41517409)
SECONDS_PER_MINUTE = 60;
MINUTES_PER_HOUR = 60;
HOURS_PER_DAY = 24;
DAYS_PER_SECOND = SECONDS_PER_MINUTE * MINUTES_PER_HOUR * HOURS_PER_DAY