digitalmars.D.bugs - [Issue 5506] New: StoppingPolicy.longest doesn't work well
- d-bugmail puremagic.com (68/68) Jan 30 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5506
- d-bugmail puremagic.com (10/10) Jan 30 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5506
- d-bugmail puremagic.com (12/12) Jan 30 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5506
- d-bugmail puremagic.com (12/16) Jan 30 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5506
http://d.puremagic.com/issues/show_bug.cgi?id=5506 Summary: StoppingPolicy.longest doesn't work well Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Keywords: wrong-code Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: bearophile_hugs eml.cc --- Comment #0 from bearophile_hugs eml.cc 2011-01-30 04:59:21 PST --- The purpose of std.range.StoppingPolicy.longest is to change the behaviour of zip to "Stop when the longest range is exhausted". But this code with DMD 2.051 shows it doesn't stop looping (problem found by tsukikage): import std.c.stdio:printf; import std.range: zip, StoppingPolicy; void main() { int[] array = [1, 2]; auto count = 0; foreach (p; zip(StoppingPolicy.longest, array)) if (count++ < 30) printf("%d\n", p[0]); else break; } Output: 1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ------------------------------ Additionally a small enhancement request. Instead of writing: zip(StoppingPolicy.longest, array) I think this is enough, and shorter, but a bit less clear, so I am not sure if this OK: zip(Zip.longest, array) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 30 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5506 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 30 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5506 klickverbot <code klickverbot.at> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |code klickverbot.at --- Comment #1 from klickverbot <code klickverbot.at> 2011-01-30 14:42:44 PST --- Oh, sorry, I didn't notice that you already assigned it to yourself, Andrei – I just submitted a patch via a GitHub pull request: https://github.com/D-Programming-Language/phobos/pull/1 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 30 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5506 Andrei Alexandrescu <andrei metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED --- Comment #2 from Andrei Alexandrescu <andrei metalanguage.com> 2011-01-30 21:40:53 PST --- (In reply to comment #1)Oh, sorry, I didn't notice that you already assigned it to yourself, Andrei – I just submitted a patch via a GitHub pull request: https://github.com/D-Programming-Language/phobos/pull/1The pull request is a great way. I just followed it. Thanks very much! -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 30 2011