in reply to The philosophy behind element reference syntax
If you really want @array[$i], which is something that I will probably dislike in Perl 6 then you can use the module Perl6::Variables
What follows are some useless arguments why I think $array[$i] is good...
Because you are refering to a scalar. An array (and a hash) can only contains a scalar.
By refering to a single element with $ you have the advantage (or not?) that you know that the prefix of the right part of the assigment has to be the same as the prefix of the left part.
This last thingie might make it easier to spot bugs if you are storing an array slice in a scalar (or not?).
If you put an array slice on the right part of the assigment (after the = that is) then it will return the last value, which might not be what you expected at all...
This would also enable you to build your own code checker which would check if each part of the assigment uses the correct prefix.
|
|---|