JuliaLang/julia — pull request #5226 by JeffBezanson (2013-12-23 19:55:13+00:00)
Title: proposed new array assignment shape matching rule

would fix #4048, #4383

This rule ignores singleton dimensions, and allows the last dimension of one side to match all trailing dimensions of the other.

The logic to implement this is pretty complicated, and I hope some code simplifications can be found. Indexing-related code always makes my brain freeze.

Right now, we don't even have a consistent rule. For example the left-hand side `A[1, 1:n]` permits different right-hand sides than `A[1:1, 1:n]`. And 1-d right-hand sides are special-cased, but the general version is to allow the last dimension of the RHS to match trailing indexes.

A rule like this is safe regardless of how we decide to change the number of dimensions returned by `getindex`.