[Issue 3813] Bad writeln of arrays

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Oct 29 17:29:50 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=3813



--- Comment #8 from bearophile_hugs at eml.cc 2010-10-29 17:28:53 PDT ---
import std.stdio, std.range;
void main() {
    writeln(iota(5));
}


With DMD 2.050 that program prints:

[0, 1, 2, 3, 4]

But that's not an array, it's a lazy sequence, and I'd like to be able to tell
apart an array from a lazy sequence in a printout.

A possible simple way to tell them apart is to print that lazy range like this,
like an array, but with semicolons instead of commas (in some languages this
syntax is used to tell apart linked lists from arrays, but in D lazy ranges are
probably more common than lists):

[0; 1; 2; 3; 4]

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list