Is D actually |-----------this-----powerful-----------|?

Kagamin spam at here.lot
Wed Jun 13 07:55:20 PDT 2012


On Saturday, 9 June 2012 at 17:07:19 UTC, David Piepgrass wrote:
> auto mass = kg(2.0);
> auto accel = 1.0;
> auto force = mass*accel;
> accel += metresPerSecondSquared(9.81); // units of 'force' and 
> 'accel' now known
> force += pounds(3.0);                  // unit mismatch detected

accel will be double. I guess you want bidirectional type 
inference. I think it was done for python, but resulted in too 
big compilation times (the times are ok for a helloworld).


More information about the Digitalmars-d-learn mailing list