(git HEAD) std.datetime spewing deprecation messages

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 3 10:00:56 PDT 2014


On Tue, 3 Jun 2014 07:21:12 -0700
"H. S. Teoh via Digitalmars-d" <digitalmars-d at puremagic.com> wrote:

> https://issues.dlang.org/show_bug.cgi?id=12846
>
> Since when is x.hours, x.minutes, etc., deprecated?

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.

https://issues.dlang.org/show_bug.cgi?id=12837

>  Well, in any case, looks like std.datetime needs to be fixed.

I previously had those changes in a pull that was just merged, except that I
removed them after Steven started complaining about

https://github.com/D-Programming-Language/druntime/pull/822

being merged (which is where the deprecations were introduced), on the theory
that that would make reverting them harder. I have a new pull which fixes the
two lines in std.datetime which were affected:

https://github.com/D-Programming-Language/phobos/pull/2228

- Jonathan M Davis


More information about the Digitalmars-d mailing list