https://issues.dlang.org/show_bug.cgi?id=21808

--- Comment #5 from Berni44 <[email protected]> ---
(In reply to Bolpat from comment #4)
> For tuples' %( %) expansion format, reordering works:
> 
>     import std.typecons, std.stdio;
>     writefln("%( %2$s (%1$s) %)", tuple(1, "one"));
>     // prints: one (1)

I'd guess, that this was unintended (there is no unittest containing this, nor
was it mentioned in the PR introducing this) and should be considered a bug (or
an unknown feature?).

Compare:

writefln("%( %2$s (%1$s) %|%)", tuple(1, "one"));

Now it throws. The reason, why the first version works is, because under the
hood it is transformed to something similar to

writefln(" %2$s (%1$s) ", 1, "one");

And now you've got the elements of the tuple as arguments.

Anyway, as I wrote above and in the PR: I like the idea. Let's see, if it will
be accepted.

--

Reply via email to