digitalmars.D.learn - Cannot understand deprecation message recently added to Phobos
- =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= (8/8) Jun 11 2014 Can somebody explain the meaning of split in the error message
- Kapps (2/10) Jun 11 2014 https://github.com/D-Programming-Language/druntime/pull/825
- =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= (16/31) Jun 11 2014 Ok, I replaced
- =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= (9/10) Jun 11 2014 I updated
- Steven Schveighoffer (7/21) Jun 12 2014 =
- Steven Schveighoffer (21/28) Jun 11 2014 =
- =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= (2/3) Jun 11 2014 Ok.
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
Jun 11 2014
On Wednesday, 11 June 2014 at 20:59:25 UTC, Nordlöw 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.dhttps://github.com/D-Programming-Language/druntime/pull/825
Jun 11 2014
On Wednesday, 11 June 2014 at 21:06:42 UTC, Kapps wrote:On Wednesday, 11 June 2014 at 20:59:25 UTC, Nordlöw wrote:Ok, I replaced immutable weeks = dur.weeks(); with immutable weeks = dur.split!"weeks"; but my code using it if (weeks) { if (weeks < 52) fails as pprint.d(39,9): Error: expression weeks of type immutable(SplitUnits) does not have a boolean value pprint.d(41,13): Error: incompatible types for ((weeks) < (52)): 'immutable(SplitUnits)' and 'int' Sorry but I don't understand what to do with the struct SplitUnits.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.dhttps://github.com/D-Programming-Language/druntime/pull/825
Jun 11 2014
https://github.com/D-Programming-Language/druntime/pull/825I updated https://github.com/nordlow/justd/blob/master/pprint.d with two versions of shortDurationString(). DMD picks the right one using static if (__VERSION__ >= 2066L) // new else // old I hope I it right this time.
Jun 11 2014
On Wed, 11 Jun 2014 17:06:41 -0400, Kapps <opantm2+spam gmail.com> wrote= :On Wednesday, 11 June 2014 at 20:59:25 UTC, Nordl=C3=B6w 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=Now fixed, is the message clearer for you? https://github.com/D-Programming-Language/druntime/pull/837 -Stevegiven by function shortDurationString() at https://github.com/nordlow/justd/blob/master/pprint.dhttps://github.com/D-Programming-Language/druntime/pull/825
Jun 12 2014
On Wed, 11 Jun 2014 16:59:24 -0400, Nordl=C3=B6w <per.nordlow 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.dActually, 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
Jun 11 2014
You can safely change your code to use total!"weeks" instead.Ok. Thx
Jun 11 2014