[Issue 5376] New: writeln doesn't print immutable lazy sequences

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 26 02:07:58 PST 2010


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

           Summary: writeln doesn't print immutable lazy sequences
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            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-12-26 02:05:18 PST ---
import std.stdio, std.algorithm;
void main() {
    const(int[]) arr1 = [1, 2, 3];
    auto sequence1 = map!q{ -a }(arr1);
    writeln(sequence1);

    const sequence2 = map!q{ -a }(arr1);
    writeln(sequence2);

    immutable(int[]) arr2 = [1, 2, 3];
    immutable sequence3 = map!q{ -a }(arr2);
    writeln(sequence3);
}


DMD 2.051 prints:

[-1, -2, -3]
const(Map!(result,const(int[])))
immutable(Map!(result,immutable(int[])))


But I'd like it to print the contents of the second and third lazy sequences
too, like (note the semicolons, very useful to tell apart arrays from lazy
sequences, see bug 3813 for the rationale):

[-1; -2; -3]
[-1; -2; -3]
[-1; -2; -3]


Or maybe something like:

[-1; -2; -3]
const([-1; -2; -3])
immutable([-1; -2; -3])


But note that this is currently a syntax error:

void main() {
    auto a = const([1, 2, 3]);
}

-- 
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