
Henning Thielemann wrote:
I recently wanted to move from old-time to time in my bibtex package, but I was no longer so enthusiastic about it, when I became aware, that for instance weekdays and months are handled as plain numbers. Wouldn't it be better to make them enumerations or newtypes (if efficiency is important)? For a complex matter like coping with time it would be nice to have precise types in order to know, what can be converted to what given what context. In case of weekdays and months a custom type would also make it irrelevant for the user, whether you count days and months starting from zero or one.
I'm all for using newtypes instead of plain numbers, but there are some problems. Namely, what *is* a "day"? Is 31 a day? Well, it depends which month we're in. Is 364 a day? Well, it depends whether days include days of the year instead of just days of some month. Is 4982 a day? Not if we take "day" to be ordinal, naming the days of the month/year; but it would be fine if we consider "day" as a unit of duration for cardinals. Similar problems arise for the definition of a "second" (due to leap seconds), and for other units for similar reasons. This may be why they didn't use enumerations/newtypes. But I think using newtypes for the ordinal concepts (and ignoring the cardinal concepts) is better than doing nothing. -- Live well, ~wren