[phobos] datetime review
Jonathan M Davis
jmdavisProg at gmx.com
Tue Oct 12 18:06:59 PDT 2010
On Tuesday, October 12, 2010 17:17:38 Michel Fortin wrote:
> Le 2010-10-12 à 17:14, Jonathan M Davis a écrit :
> > I'm sure that there are applications which care about calendars other
> > than the Gregorian Calendar, but I really do think that it's a niche
> > need.
>
> I agree to that it's niche, at least in the part of the world where I
> leave.
>
> > As part of making the world interconnect better, a lot of this sort of
> > thing is increasingly being standardized, so I would expect alternate
> > calendars to actually be needed less rather than more.
>
> That's a way to see things. But standardization doesn't always work,
> sometime because something is seen as a cultural icon, or it just takes
> much longer than you'd expect. How long did it take for everyone to
> abandon Julian and pass to Gregorian? Adoption: 1582 in Rome, 1752 for
> Britain, 1918 for Russia, 1924 for Greece. Total: 342 years; and all these
> countries were Christian.
>
> Similarly to the Gregorian calendar being an ISO standard, you could say
> that English is becoming de facto the international language today. This
> hasn't reduced the need for localization in software, quite the contrary:
> as computers are used more and more everywhere, the need for localization
> increased as it reached less technically-minded persons.
>
> And Wikipedia says that many calendars other than Gregorian are currently
> in wide use today:
>
> """
> While the Gregorian calendar is widely used in Israel's business and
> day-to-day affairs, the Hebrew calendar, used by Jews worldwide for
> religious and cultural affairs, also influences civil matters in Israel
> (such as national holidays) and can be used there for business dealings
> (such as for the dating of checks).
>
> The Iranian (Persian) calendar is used in Iran and Afghanistan. The Islamic
> calendar is used by most non-Iranian Muslims worldwide. The Chinese,
> Hebrew, Hindu, and Julian calendars are widely used for religious and/or
> social purposes. The Ethiopian calendar or Ethiopic calendar is the
> principal calendar used in Ethiopiaand Eritrea. In Thailand, where the
> Thai solar calendar is used, the months and days have adopted the western
> standard, although the years are still based on the traditional Buddhist
> calendar. Bahá'ís worldwide use the Bahá'í calendar. """
> <http://en.wikipedia.org/wiki/Calendar#Currently_used_calendars>
>
> Speaking of standardization: when is the US going to pass to the metric
> system? I don't really want an answer, but it shows that you shouldn't
> really count on standardization until has actually happened.
All great points, though computers do tend to stick to standardization better
than many other things (though all you to do is look at IE to know that that
doesn't always happen either).
However, I still don't think that it makes much sense to worry about it for
std.datetime, and I very much doubt that I would ever seriously consider writing
a date/time library which really tried to worry about other calendars. If there
are easy, non-intrusive ways to make it so that 3rd party libraries can use some
of datetime to implement their own library code, that's fine, but I don't want to
bend over backwards trying to get std.datetime to work with calendar
functionality that doesn't and may never exist. So, stuff like durations,
intervals, and ranges will likely be appropriately useable with other non-
Gregorian date types, but I don't think that it's worth the extra cost to try
and refactor out the portions of Date, DateTime, or SysTime which are calendar-
agnostic - particularly when so little of it is likely to be calendar-agnostic.
I haven't look at the Cocoa API that you mentioned, and maybe they did a
fantastic job of finding a way to do it, but from what I can see, the core stuff
which would be calendar-agnostic is so small that there's really no value in
trying to refactor it out. It would be so small that you might as well just
reimplement it in non-Gregorian date types.
- Jonathan M Davis
More information about the phobos
mailing list