[Issue 12743] tuple printing of alias names

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue May 13 09:44:19 PDT 2014


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

bearophile_hugs at eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|DUPLICATE                   |---

--- Comment #2 from bearophile_hugs at eml.cc ---
(In reply to Andrej Mitrovic from comment #1)
> 
> *** This issue has been marked as a duplicate of issue 9593 ***

Reopened because they are two quite different issues.

In Issue 9593 I've asked for a way to avoid the printing of the tuple type with
a formatting string using "-":

writefln("%-s", data[0]);
==>
("Fred", 5)

writefln("%-(%s %)", data);
==>
("Fred", 5) ("Bob", 10) ("Mark", 30)


While in this issue I have suggested to print the alias name (or to introduce a
NamedTuple):

alias Pair2 = Tuple!(int, int);
auto a2 = [Pair2(1, 2), Pair2(3, 4)];
a2.writeln;
==>
[Pair2(1, 2), Pair2(3, 4)]

--


More information about the Digitalmars-d-bugs mailing list