www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4660] New: Different writeln output for lazy sequences

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: bearophile_hugs eml.cc



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: -------
Aug 17 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4660


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei metalanguage.com
         AssignedTo|nobody puremagic.com        |andrei metalanguage.com


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 09 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4660




Now I think that a better output is:
[2; 3; 4]

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