(git HEAD) std.datetime spewing deprecation messages

Kagamin via Digitalmars-d digitalmars-d at puremagic.com
Wed Jun 4 04:28:51 PDT 2014


On Tuesday, 3 June 2014 at 17:01:15 UTC, Jonathan M Davis via 
Digitalmars-d wrote:
> As of Sunday. The problem is that they seem to be very prone 
> for misuse.
> Not only do they not match what TickDuration uses those same 
> names for (it
> uses them for the equivelent of total!"hours"(), etc. rather 
> than
> get!"hours"(), etc.), which has come up a number of times 
> before, but what
> I've found at work (where we have a C++ port of Duration) is 
> that pretty much
> everyone keeps using get when they meant total, consistently 
> causing subtle
> bugs. So, I've come to the conclusion that the current design 
> is just too
> bug-prone, and by deprecating the individual getters and 
> renaming get to
> getOnly, I hope that that will seriously reduce the risk of 
> misuse.

Does one really needs only one component, but not the others? 
Maybe it should provide full computed broken form instead of 
separate components?

auto d=dur.breakUp;
d.hours; d.minutes; d.seconds;


More information about the Digitalmars-d mailing list