digitalmars.D.bugs - [Issue 5376] New: writeln doesn't print immutable lazy sequences
- d-bugmail puremagic.com (45/45) Dec 26 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5376
- d-bugmail puremagic.com (13/13) Dec 26 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5376
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 puremagic.com
ReportedBy: bearophile_hugs eml.cc
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: -------
Dec 26 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5376
Simen Kjaeraas <simen.kjaras gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |simen.kjaras gmail.com
PST ---
This is the same old problem of ranges not supporting tail-const or
tail-immutable.
I've filed that as a separate issue -
http://d.puremagic.com/issues/show_bug.cgi?id=5377
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 26 2010








d-bugmail puremagic.com