Documentation for method ASSIGN-POS
Documentation for method ASSIGN-POS, assembled from the following types:
multi method ASSIGN-POS (::?CLASS: , )
Expected to set the element at position
$index to the value
$new. Implementing this is entirely optional; if you don't,
self.AT-POS($index) = $new is used instead, and if you do, you should make sure it has the same effect.
This is meant as an opt-in performance optimization, so that simple assignments like
@numbers = "five" can operate without having to call
AT-POS (which would have to create and return a potentially expensive container object).
Note that implementing
ASSIGN-POS does not relieve you from making
rw method though, because less trivial assignments/modifications such as
@numbers++ will still use