Skip to content

Instantly share code, notes, and snippets.

@dogbert17
Last active May 23, 2016 20:25
Attempt to document method 'isa' in Mu
=head2 routine isa
multi method isa(Mu $type) returns Bool:D
multi method isa(Str:D $type) returns Bool:D
Returns C<True> if the invocant is an instance of class C<$type>, a subset type or a derived class (through inheritance) of C<$type>.
my $i = 17;
say $i.isa("Int"); # True
say $i.isa(Any); # True
A more idiomatic way to do this is to use the smartmatch operator C<~~>.
my $s = "String";
say $i ~~ Str; # True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment