[phobos] datetime review

Jonathan M Davis jmdavisProg at gmx.com
Sun Oct 10 09:16:06 PDT 2010


On Sunday 10 October 2010 06:43:59 Andrei Alexandrescu wrote:
> Then you have only one duration type that's always
> precise and you can drop the interval type. If someone wants to figure
> out e.g. the number of months between two dates, we can provide specific
> functions.

I meant to reply to this in another response, but apparently I missed  it. Sorry 
about that.

In any case, if we get rid of the interval type, we're basically saying that we 
doing care about the ability to check whether intervals intersect or adjoin one 
another or about getting intersections of them or merging them, etc. That 
functionality is from Boost and not something that I thought of myself. In fact, 
I rather doubt that I'll ever use it in my own code, but I'm not sure that we 
want to get rid of it. It strikes me as the sort of thing that a few programmers 
will love and be very grateful that it's there but which most programmers won't 
care about at all. If we ditch it, it wouldn't be all that hard to just create 
some functions which return ranges given a begin and an end rather than using 
the time points to create an interval which we get a range from, but I don't 
know if we want to ditch it. It would simplify the code but at the cost of some 
potentially useful functionality. You could try and have some of it as free-form 
functions, but it wouldn't work anywhere near as well as with an actual type. 
So, I'm not totally against ditching interval types, but I question that doing 
so is a good idea.

- Jonathan M Davis


More information about the phobos mailing list