Nick Sabalausky wrote:
"BCS" <[email protected]> wrote in message news:[email protected]...
Reply to Nick,

"Andrei Alexandrescu" <[email protected]> wrote in message
news:[email protected]...

BCS wrote:
One option would be to not throw an error if the format string uses
indexing formats (e.i. out of order formatting)

Yah, that's an option I considered. Maybe it's the best way to go.

That would be far too clumbsy, unless you made it into two separate
functions.

For instance (psuedocode):
auto userInput = getUserInput()
// userInput now contains "{Name} at {Address}", zip deliberately
ignored
writefln(userInput, name, address, zip); // They're used in-order, but
there
shouldn't be an error
They are in order but are listed by name so the error doesn't throw. The case where the error would be thrown is where the only format strings used are the "get the next arg" kind.


I was just using names for illustrative purposes. Also, I was under the impression that printf-style "get the next arg" formatting codes were the only ones writef supported. Is this not so?



Since a few versions ago writef supports positional arguments with Posix syntax.

Andrei

Reply via email to