Cannot understand deprecation message recently added to Phobos
"Nordlöw" via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jun 11 14:49:13 PDT 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:
>> 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
>
> https://github.com/D-Programming-Language/druntime/pull/825
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.
More information about the Digitalmars-d-learn
mailing list