BIND-POS
ErrorsCollection

BIND-POS

Synthesised documentation from language/subscripts

From language/subscripts

See Original text in context

multi method BIND-POS (::?CLASS:D: $index, \new)

Expected to bind the value or container new to the slot at position $index, replacing any container that would be naturally found there. This is what is called when you write:

my $x = 10;
@numbers[5:= $x;

The generic Array class supports this in order to allow building complex linked data structures, but for more domain-specific types it may not make sense, so don't feel compelled to implement it. If you don't, users will get an appropriate error message when they try to bind to a positional slot of an object of this type.