On 9/6/11 12:32 PM, bearophile wrote:
Christophe:
Moreover, the output of
writeln(T) and writeln(T[]) should be consistent.
Years after my first request, now given this program:
import std.stdio;
void main() {
writeln("foo");
writeln(["foo"]);
}
D prints (this problem is what has pushed me to add bug reports to Bugzilla in
the first place, so it was one of my pet peeves):
Yah, the problem with making array elements printed the same as
individual items is ambiguity. Inside an array the reader (human or not)
must unambiguously identify elements from separators, otherwise printing
square brackets and commas results in confusion.
This reminds me, we should have a function e.g. std.conv.escape() that
given the string "foo\nbar" returns the string "\"foo\\nbar\"". I mean
sometimes we want to print "DSON"-formatted stuff without it being in an
array.
Andrei