[phobos] Status of std.gregorian

Lars Tandle Kyllingstad lars at kyllingen.net
Tue Aug 17 03:11:19 PDT 2010


On Tue, 2010-08-17 at 02:42 -0700, Jonathan M Davis wrote:
> On Sunday 15 August 2010 05:36:08 Andrei Alexandrescu wrote:
> > I very strongly suggest to stick with copying Boost's or C++0x's date
> > and time facilities, unless we find some clearly superior ways
> > facilitated by D's features. Developing our own date/time library from
> > scratch risks of being at best just as capable as Boost/C++0x but
> > guaranteed unfamiliar to everyone.
> 
> Okay. I've started looking at boost's date/time stuff, and they do appear to 
> maintain time internally in UTC rather than converting it to local time, which 
> was my biggest fear, since I've run into a lot of problems with that sort of 
> thing in the past. So, overall, I'd say that it looks quite good (this _is_ 
> boost after all).

Cool!


> I do have a few concerns, however.
> 
> 1. I'd argue that the boost date/time libraries are way too complex for normal 
> usage. If you want to do detailed date/time stuff, they look incredibly flexible, 
> but I'd be very worried that for the average case they're seriously overkill. 
> I'd be worried that programmers looking for basic date/time functionality will 
> quickly get lost in dealing with the full boost implementation and that they 
> would do better to have a seriously simplified date/time facility without all of 
> the bells and whistles. That's not to say that we shouldn't implement the boost 
> stuff in Phobos, but I'd be concerned if it were the only date/time facility 
> available.

When I first suggested we look at boost::date_time, I didn't really mean
to suggest a complete port.  Date_time is huge, and full of things the
average user will never need.  It will mean a lot of work, and as you
say, we will end up with a pretty scary-looking date/time module.

My opinion is that instead of duplicating the whole shebang, we should:

a) Embrace its basic concepts.  For instance, I find the
TimePoint/TimeDuration/TimeInterval separation quite intuitive and
elegant:

http://www.boost.org/doc/libs/1_42_0/doc/html/date_time.html#date_time.conceptual


b). Pick a sensible subset of the boost:date_time functionality, and
look at its code to figure out how it is best implemented.


> [...] 
> 
> 3. Do you care whether the internals are the same or if the API is absolutely 
> identical (or at least as identical as reasonably possible when going from C++ 
> to D)? 
> [...] 

Personally, I certainly don't think having an identical API is a goal in
itself.  D's standard library should have an API that is tailored to D,
not C++.

-Lars



More information about the phobos mailing list