X::Bind::Slice Reference
Error due to binding to a slice
What it is #
Position in the hierarchy #
| Inherits from | — |
| Does | — |
| Inherited by | X::Bind::ZenSlice |
Routines #
Signatures are reproduced from the documentation, including their declared return types. A routine listed here is part of the type's published interface; whether Raku++ implements it is a separate question, answered by the examples below.
method type #
method type(X::Bind::Slice:D:)
returns the type object of the thing that you tried to slice-bind, for example Array, List or Hash.
Examples, run three ways #
Every example below comes from the official documentation, together with the output that documentation asserts. Each was then executed by Rakudo and by Raku++ when this page was built. Where the three agree, one result is shown; where they do not, all three are — because which of them is wrong is exactly the information worth having.
2 doc-drift · 1 no-output
class X::Bind::Slice is Exception {}Not executed: the documentation states no expected output for this example.
my @a; @a[0, 1] := [42];
CATCH { default { put .^name, ': ', .Str } };
# OUTPUT: «X::Bind::Slice: Cannot bind to Array slice»X::Bind::Slice: Cannot bind to Array slice
Both engines agree; the documentation states something else. Trust the engines.
my %h; %h<a b> := {};
CATCH { default { put .^name, ': ', .Str } };
# OUTPUT: «X::Bind::Slice: Cannot bind to Hash slice»X::Bind::Slice: Cannot bind to Hash slice
Both engines agree; the documentation states something else. Trust the engines.