March 27, 2014 [Issue 10541] Failure writing to elements of std.range.zip | ||||
---|---|---|---|---|
| ||||
https://d.puremagic.com/issues/show_bug.cgi?id=10541 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrej.mitrovich@gmail.com Severity|normal |major --- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2014-03-27 21:20:15 CET --- Re-tagged as a major issue, 'ref' not having an effect is a big issue IMHO. Simple test-case: ----- import std.range; void main() { int[] x = [1, 1, 1]; int[] y = [1, 2, 3]; foreach (a, ref b; lockstep(x, y)) b += a; assert(y == [2, 3, 4]); // ok foreach (a, ref b; zip(x, y)) b += a; assert(y == [3, 4, 5]); // fails, it's still [2, 3, 4] } ----- Without zip supporting ref access Issue 8155 should not be considered yet. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 27, 2014 [Issue 10541] using ref foreach parameters with std.range.zip is a no-op | ||||
---|---|---|---|---|
| ||||
https://d.puremagic.com/issues/show_bug.cgi?id=10541 monarchdodra@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |monarchdodra@gmail.com --- Comment #3 from monarchdodra@gmail.com 2014-03-27 14:34:36 PDT --- More than just allowing Zip to be used in a "foreach ref", the real issue is the code compiling at all: Issue 11934 - Allow `ref` in `foreach` over range iff `front` returns by `ref` https://d.puremagic.com/issues/show_bug.cgi?id=11934 Issue 11934 - Allow `ref` in `foreach` over range iff `front` returns by `ref` https://d.puremagic.com/issues/show_bug.cgi?id=11935 Issue 4707 - auto ref for foreach loops https://d.puremagic.com/issues/show_bug.cgi?id=4707 As for this specific issue, I don't really see any way to fix Zip, short of putting lockstep's opApply code into Zip. As a matter of fact, why don't we just do that? Performance? I seem to remember opApply base foreach is slow (creates a delegate)? -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation