On Thu, 06 Apr 2017 13:46:00 -0700, alex.jakime...@gmail.com wrote: > Another thing to note is that this array behavior was changed during > the GLR, but hashes remained the same. Perhaps that was an oversight.
I certainly considered this matter during the course of the GLR, and felt that trying to make the two assignment cases behave the same would count as a foolish consistency. And it's not like there wasn't already precedent for assignment to vary in its rules by sigil. After all, list and item assignment parse at difference precedence levels - which is arguably a much bigger difference than a different choice over flattening! In fact, it's pretty consistent throughout Perl 6 that you need to know about the target of an assignment in order to know what it's going to do with the source. Assignment into a List like `($a, $b) = @c` will happily discard unused values, while assignment into a fixed size array will complain if there's too many items. If it's a multi-dimensional array then it will look for the shape to be replicated in the source, and complain if it's not "close enough" (so that's another case where a nested structure on the right will get special treatment). So even within list-space, we have differing assignment semantics based upon the target. /jnthn