[Issue 21808] std.format: It should be possible to change the order of key and value of AAs.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 29 18:52:31 UTC 2021


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

--- Comment #4 from Bolpat <qs.il.paperinik at gmail.com> ---
(In reply to Berni44 from comment #2)
> Changing this to "enhancement", because normal use of positional parameters
> has a completely different meaning - it gives the position of an argument in
> the function call and has nothing to do with the order of the elements of a
> single argument.
> 
> Anyway, I see the need for the possibility to change the order; and
> positional arguments don't make any sense inside of a compound specifier.
> Therefore I think, it is OK to (ab)use them like suggested here. But then
> it's not a bug, but an enhancement.

For tuples' %( %) expansion format, reordering works:

    import std.typecons, std.stdio;
    writefln("%( %2$s (%1$s) %)", tuple(1, "one"));
    // prints: one (1)

--


More information about the Digitalmars-d-bugs mailing list