BrowserREPL-button-tip-on BrowserREPL-button-tip-off

EditButtonTip 2024-05-18

class X::Bind::Slice

Error due to binding to a slice

class X::Bind::Slice is Exception {}
Code

When you try to bind to an array or hash slice:

my @a; @a[0, 1] := [42];
CATCH { default { put .^name, ': ', .Str } };
# OUTPUT: «X::Bind::Slice: Cannot bind to Array slice␤»
Code

and

my %h; %h<a b> := {};
CATCH { default { put .^name, ': ', .Str } };
# OUTPUT: «X::Bind::Slice: Cannot bind to Hash slice␤»
Code

you get an exception of type ::Bind::Slice.

Methods§

method type§

method type(X::Bind::Slice:D:)
Code

returns the type object of the thing that you tried to slice-bind, for example Array, List or Hash.