[Issue 4660] New: Different writeln output for lazy sequences

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 17 05:55:47 PDT 2010


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

           Summary: Different writeln output for lazy sequences
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-08-17 05:55:42 PDT ---
This D2 program uses writeln to print a lazy sequence of integers:

import std.stdio: writeln;
import std.algorithm: map;
void main() {
    auto r = map!q{a+1}([1, 2, 3]);
    writeln(r);
}


Output with dmd 2.048:
[2, 3, 4]


But when I print a lazy sequence I'd like some cue in the textual output that
the data being printed isn't an array.

In theory the delimiters can just be omitted for lazy sequences, but then if
you print a collection of lazy sequences you can't where one sequence ends and
the successive ends. So it's better to use delimiters, but different ones.

So this is a possible better output:
(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