Andrei Alexandrescu:

But the bottom line is I don't think we need to force anything on anybody. If anything, we could split up the internal format
implementation and provide format and safeFormat functions.

format("%s %s", 1);  // no exceptions

NO! This is exactly the kind of code that is buggy and useless. The right use cases involve more arguments than format specifiers.

Currently this code is accepted (and it prints "A B10"), but I think it should be not accepted (also why is it 1-based?):

import std.stdio;
void main() {
    writefln("A%2$s B%1$s", 10);
}


The only point I'd negotiate would be to not throw with positional arguments, and throw with sequential arguments. All code that cares uses
positional specifiers anyway.

I have opened this ER:
http://d.puremagic.com/issues/show_bug.cgi?id=10489

Bye,
bearophile

Reply via email to