Article Review: Migrating from std.date to std.datetime

Rainer Schuetze r.sagitario at gmx.de
Sun May 15 05:26:20 PDT 2011


Jonathan M Davis wrote:
> On 2011-05-15 03:34, Rainer Schuetze wrote:
>> Thanks a lot for writing the article. I was just about to get rid of
>> std.date and migrate to std.datetime, so it's perfect timing. ;-)
>>
>> A few nitpicks:
>>
>> - a short motivation for using hecto-nano-seconds would be nice, it's
>> not really the most obvious choice.
> 
> It's the highest precision that you can have and still have a decent range of 
> values in a 64-bit integer. Going by 10 ns units would result in the range 
> being too small, but 100 ns gives you from around 29,000 B.C. to 29,000 A.D. 
> It's also what C# uses.

Thanks for the clarification (I know it's also the resolution from the 
Windows API). I suggest to put it somewhere in the article or the 
documentation.


>> - there is an alias for std.string.indexOf in std.datetime, that causes
>> ambiguities when imported with other modules. (AFAICT it is used to
>> disambiguate std.algorithm.indexOf and std.string.indexOf, which are bad
>> by themselves, but it'd be better to use explicite std.string.indexOf in
>> the few places in std.datetime).
> 
> That's a bug. I shouldn't have done that. I didn't think about the alias being 
> public when I did it. It has now been fixed on github.
> 

Unfortunately, for some obscure reason, private module declarations are 
still placed into the overload set, so your fix does not help.
You should either alias it to something unlikely to clash with something 
else or use fully qualified names (though this does not allow UFCS).

>> - the documentation for std.datetime.WindowsTimeZone is missing on the
>> website
> 
> I don't know why it would be. It's probably a bug relating to the new StdDdoc 
> versioning that we switched to (instead of using D_Ddoc which screwed up 
> people who build the documentation at the same time as their code - a bad 
> practice IMHO, but we decided to not set it up so that it didn't work when 
> using Phobos). As WindowsTimeZone is only on Windows, it definitely had to be 
> versioned with StdDdoc.

I just noticed that it shows up on 
http://www.d-programming-language.org/phobos/std_datetime.html,
but not on http://www.digitalmars.com/d/2.0/phobos/std_datetime.html

> 
>> - the documentation for std.file.getTimesWin/Posix is not found on the
>> website (why the different function names?)
> 
> Probably a StdDdoc problem as well. 

also on d-programming-lanuage.org.



More information about the Digitalmars-d mailing list