Oops, forgot the code.

"4. Unit inference engine: Given some notation for optionally indicating units, e.g. unit(value), could a D metaprogram examine the following code, infer the correct units, and issue an error message on the last line?

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

P.S. And can D output 'pre-processed' source, i.e. the code after metaprograms have executed?

Reply via email to