Hey all,
Over in the new compiler, we’ve discovered a bug - basically a[:][2]
and a[:, 2]
are equivalent if they appear as the destination for an assignment, but on the right hand size the a[:][2]
is equivalent to a[2]
while a[:, 2]
selects the 2nd column of a
.
We were thinking about completely removing the ability to have more than one index list on the left hand side of assignment, and possibly on the right hand side as well. The latter would probably be a Stan 3 change as it would break existing code, though it would be easy to write a translation tool for this (as well as the other Stan 3 backwards-incompatible things we’re thinking about like removing deprecated features and moving dimensions on declarations).
Bugfix idea 1: (disallow on lhs) would mean we’d throw an error in the compiler if we see something like a[x][y] = z;
, something like "Please rewrite to a[x, y] = z;
"
Optional additional simplification: disallow on rhs as well - print(a[x][y]);
throws an error “Please rewrite as print(a[x, y]
);.”