http://d.puremagic.com/issues/show_bug.cgi?id=3188
Summary: remove opIndexAssign from the language Product: D Version: 2.031 Platform: Other OS/Version: All Status: NEW Severity: enhancement Priority: P1 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: k-fo...@onu.edu Despite being redundant, my main gripe with opIndexAssign is that it can even get in the way. For instance: --- import std.stdio; struct Arr(size_t W, size_t H, T) { T[W * H] arr; this(T[W*H] rhs) { arr = rhs; } ref T opIndex(size_t row, size_t col) { return arr[row + W*col]; } } int main() { auto a = Arr!(2, 2, int)( [1, 2, 3, 4] ); writeln( "a[1, 1] = ", a[1, 1] ); // a[1, 1] = 4 a[1, 1] += 2; writeln( "a[1, 1] = ", a[1, 1] ); // a[1, 1] = 6 // This requires opIndexAssign, but for no good reason //a[1, 1] = 42; //writeln( "a[1, 1] = ", a[1, 1] ); return 0; } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------