Am 26.06.2013 21:53, schrieb dennis luehring:
Am 26.06.2013 21:33, schrieb Andrei Alexandrescu:
On 6/26/13 11:08 AM, bearophile wrote:
On the other hand this D program prints just
"10" with no errors, ignoring the second x:

import std.stdio;
void main() {
size_t x = 10;
writefln("%d", x, x);
}

In a modern statically typed language I'd like such code to give a
compile-time error.

Actually this is good because it allows to customize the format string
to print only a subset of available information (I've actually used this).

why is there always a tiny need for such tricky stuff - isn't that only
usefull in very rare cases


or better said - could then someone add a description to writefln why there is a need that writefln can "handle" more values then asked in the format-string - maybe with an example that realy shows the usefullness of this feature - and why an simple enum + if/else can't handle this also very elegant




Reply via email to