On 4/3/13 11:55 AM, Peter Alexander wrote:
On Wednesday, 3 April 2013 at 02:44:15 UTC, Andrei Alexandrescu wrote:
If we did datetime all over again, I'd give a budget of 2000 lines for
all functionality. I bet the solution would be better.

I think you are massively underestimating the complexity and subtleties
of dates and time.

May as well. I recall before I approved std.datetime I looked at the implementation sizes of similar functionality in other languages; they were all rather bulky, but std.datetime was at the high end of the range.

For comparison, min and max in std.algorithm come to nearly 200 lines on
their own, and their unittests are hopelessly lacking. Things like
min(uint.min, int.max) are not tested, even though there's specific code
to handle them. To suggest that date and time handling is a mere 10x
more complex than min/max is a bit naive in my opinion.

To put things in perspective, std.datetime has 34K lines, whereas std.algorithm has under 12K lines. The entire std/ has 191K lines. I'd be hard pressed to assess that that high proportion is justified.

Say we set out to fit std.datetime in e.g. 20K lines without loss in functionality or testing, which I'd find more reasonable. I think the result would force overall better engineering of the entire thing (and in particular better use of data structures) - constraints may be liberating.


Andrei

Reply via email to