Please vote on std.datetime

Fawzi Mohamed fawzi at gmx.ch
Fri Dec 10 03:18:29 PST 2010


On 10-dic-10, at 01:26, Andrei Alexandrescu wrote:

> Jonathan M. Davis has diligently worked on his std.datetime  
> proposal, and it has been through a few review cycles in this  
> newsgroup.
>
> It's time to vote. Please vote for or against inclusion of datetime  
> into Phobos, along with your reasons.
>
>
> Thank you,
>
> Andrei

I think it is quite complete and usable, lot of work obviously went  
into this,...
an clearly after the praise comes a "but"... so here are my comments  
on it, some are just personal preferences

- I would split the unittests to a separate test module, I like having  
unittests, but having many of them make the code more difficult for me  
to skim through, and grasp, one test (example) can be useful, but lots  
of the hide the code structure.
Maybe it is just my personal preference, but I like compact code, code  
that can be read, and so many unittests stop the flow of my reading.

- I would split this into several modules  
(Timezone,SysTime,TimeDate,Clock), and if you want a "helper" module  
that make a public export.
Modules should be used to define modules/namespaces, using classes  
seems a misuse to me (I am looking a Clock for example, which is a  
separated functionality imho).

- I find that there is a loss of orthogonality between SysTime and  
DateTime. For me there are a calendar dates, and absolute points in  
time. To interconvert between the two one needs a timezone. I would  
associate the timezone with the calendar date and *not* with the  
absolute time.
I find that SysTime makes too much effort to be a calendar date  
instead of a "point in time".
Also if one wants to use a point in time at low level it should be  
"lean and mean", what is the timezone doing there?

Last thing, well is something I would have done differently (as I said  
already in the past), is using doubles expressing number of seconds to  
represent point in time, durations, and TimeOfDay. I know other  
differs about this, but I really think that it is a very simple and  
versatile type.

Fawzi


More information about the Digitalmars-d mailing list