Skip to content

Instantly share code, notes, and snippets.

@dogbert17
Last active May 23, 2016 20:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dogbert17/6a3255180c057f37a824f417a3a0823e to your computer and use it in GitHub Desktop.
Save dogbert17/6a3255180c057f37a824f417a3a0823e to your computer and use it in GitHub Desktop.
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