Cannot understand deprecation message recently added to Phobos

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jun 11 14:43:05 PDT 2014


On Wed, 11 Jun 2014 16:59:24 -0400, Nordlöw <per.nordlow at gmail.com> wrote:

> Can somebody explain the meaning of split in the error message
>
> Deprecation: function core.time.Duration.weeks is deprecated - Please  
> use split instead. weeks was too frequently confused for total!"weeks".
>
> given by function
>
> shortDurationString()
>
> at
>
> https://github.com/nordlow/justd/blob/master/pprint.d

Actually, that may not be a valid deprecation message.

All the other unit functions do not get the total number of units, but  
there are not larger units supported by Duration. In fact, dur.weeks was  
the equivalent of dur.total!"weeks".

You can safely change your code to use total!"weeks" instead.

Jonathan, can we update this deprecation message?

The function is going away because of the confusion with smaller units.  
For example, dur.seconds could be confused as "the number of seconds in  
this duration", but it's really "the number of seconds that do not make up  
a whole minute in this duration". Basically, it's the mod remainder for  
the seconds.

-Steve


More information about the Digitalmars-d-learn mailing list