On Wednesday, 7 March 2012 at 00:25:19 UTC, Jonathan M Davis wrote:
On Tuesday, March 06, 2012 17:00:19 Brad Anderson wrote:
I wasn't around for the creation of datetime but I'm curious why a boost datetime-like duration construction shortcut approach to durations wasn't used. That is, you can write weeks(1), months(6), years(10), hours(17), minutes(12), etc. (although there is now days(int) for some reason).

Because then you've got incredibly common names used as top-level symbols.

I understand the concern but, for what it's worth, I write project scheduling software professionally so I spend a lot of time working with dates and durations. I'd have no problem with these being top level even though the chance of symbol clashing would be much higher for me than most programmers. A standard library's datetime module seems like it should have first dibs on those names anyway. I think it should gobble up that real estate.

It's also not generic at all. As it stands, you can have a function which does dur!units(value). You can't do that with weeks(1), months(6), etc.


That is a very nice feature for me as I have to work in arbitrary base units (seconds, minutes, days, hours, etc.) extensively. I definitely would want that genericity to remain. The aliases Nick wrote appear to be a good addition (unless I'm overlooking a problem with them). You keep the genericity but get brevity with the package.

Although I still haven't really made use of it yet, it was really relieving to find D had such an extensive datetime module. A lot of languages and libraries try to get away with doing the bare minimum (often just very thin and obvious wrappers over what the OS does) so thank you for putting so much time (I can only assume with how large the module is) and thought into designing something powerful that befits a powerful language.

Regards,
Brad Anderson


- Jonathan M Davis

Reply via email to