D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2310 - Inconsistent formatting of arrays in std.stdio.write() and std.conv.to!(string)()
Summary: Inconsistent formatting of arrays in std.stdio.write() and std.conv.to!(strin...
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86 Windows
: P2 trivial
Assignee: Andrei Alexandrescu
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-23 17:22 UTC by Sergey Gromov
Modified: 2015-06-09 01:20 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Sergey Gromov 2008-08-23 17:22:35 UTC
The documentation for std.stdio.write() says: "... for each argument ... format the argument (as per to!(string)(arg)) ...".  Nevertheless, arrays are formatted differently when using std.stdio.write() and std.conv.to!(string)():

import std.stdio;
import std.conv;
void main() {
	writeln([1,2,3]);		// prints [1 2 3]
	writeln(to!(string)([1,2,3]));	// prints [1,2,3]
}

I expect the formatting to be identical.
Comment 1 Andrei Alexandrescu 2010-09-26 11:28:09 UTC
Resolved by using a ", " separator by default in to!string.

http://www.dsource.org/projects/phobos/changeset/2052