https://issues.dlang.org/show_bug.cgi?id=6345
Nick Treleaven <n...@geany.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |n...@geany.org --- Comment #5 from Nick Treleaven <n...@geany.org> --- List comprehensions would cover these and avoid any ambiguity. They are also more expressive and composable than vector ops: > auto foos = new Foo[100]; > foos[].y += 10; // ******** [e.y += 10 for e in foos]; Note this doesn't need to allocate an array as the result is not used. > cdouble[100] foos; > foos[].re = 5.0; [e.re = 5.0 for e in foos]; > auto foos = new Foo[100]; > auto ints = new int[100] > ints = foos[].y; ints = [e.y for e in foos]; > float[] buffers = malloc...; > float*[] CBuffers = buffers[].ptr; float*[] cBuffers = [e.ptr for e in buffers]; Also, type inference could be used `auto cBuffers = ` because the RHS is no longer ambiguous with `float*`. (This would also solve Issue #2548). > auto M = new double[][](10, 20); > M[][1] = 1.0; [e[1] = 1.0 for e in m]; And indexes mean they can cover vector ops too: > a[] = b[] / c[]; a = [b[i] / e for i, e in c]; A benefit is that `b.length` can be larger than `c.length`. Also we can use the index variable e.g. to index b in reverse order. The key benefit however is that we can use expressions not supported by vector ops such as function calls, comparisons and the conditional operator - see issue #5636. --