Proposal for custom time string formatting in std.datetime

Jonathan M Davis jmdavisProg at gmx.com
Wed Dec 21 20:12:13 PST 2011


On Wednesday, December 21, 2011 19:57:28 Walter Bright wrote:
> My first thought is that std.datetime is already very large. Few will need a
> custom date formatter, so it should be in a separate module to:
> 
> 1. reduce cognitive load on the programmer
> 
> 2. reduce the overhead pulled in for every program that may want to use an
> std.datetime function, but not need custom formatting

It makes by far the most sense to put it on the types themselves IMHO 
(especilaly since all of the other string functions are that way), and the 
functions are templated, so the overhead is reduced if you don't use them.

If we want to address the size of std.datetime, I believe that there are far 
better ways to do it. Breaking out the benchmarking stuff (which we're likely 
to do) would be one. Another would be to take the interval and range stuff and 
put it in a separate module. It uses the time point stuff, but doesn't need to 
be in the same module to do what it does.

Yes, putting the custom formatting functions in increases the size of the 
module, but I think that if we want to do something about the size of 
std.datetime, it would make more sense to move some of its existing pieces out 
than to not put the custom time formatting on the types themselves.

- Jonathan M Davis


More information about the Digitalmars-d mailing list