SysTime.add!"days" missing

Adam D. Ruppe destructionator at gmail.com
Mon Mar 17 07:39:15 PDT 2014


On Monday, 17 March 2014 at 14:31:54 UTC, Spacen Jasset wrote:
> Thanks. What devilish magic allows for the syntax 60.days? (how 
> does it work)

There's a function in core.time:

Duration days(int n);


D functions f(x, t...) can also be called x.f(t) (or x.f without 
parameters if there's no additional arguments).

This works on all types, it is called uniform function call 
syntax, or UFCS. It lets us extend other things with new methods.


More information about the Digitalmars-d-learn mailing list