http://d.puremagic.com/issues/show_bug.cgi?id=6521
--- Comment #1 from Kenji Hara <[email protected]> 2011-08-17 18:15:36 PDT --- Expected prints: Tuple!(int)(1) const(Tuple!(int))(1) There are two ways to fix the problem. 1. Change std.typecons.Tuple!T.toString like follows: diff --git a/std/typecons.d b/std/typecons.d index b279abf..b80d6f9 100644 --- a/std/typecons.d +++ b/std/typecons.d @@ -491,9 +491,9 @@ assert(s[0] == "abc" && s[1] == 4.5); /** Converts to string. */ - string toString() + const string toString(this T)() { - enum header = typeof(this).stringof ~ "(", + enum header = T.stringof ~ "(", footer = ")", separator = ", "; Appender!string app; But this is very hackish to me. 2. Apply my pull request https://github.com/D-Programming-Language/phobos/pull/126 This patch changes formattedWrite behavior: if a struct type does not have toString method, formattedWrite formats it like POD (e.g. "TypeName(field, ...)"). I think that Tuple is just a POD type, and expected formatting also looks like the POD. So, IMHO, std.typecons.Tuple!T.toString is *just a workaround*. If formattedWrite works correctly, we will no longer need Tuple!T.toString. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
