Last active
June 25, 2017 17:18
-
-
Save dogbert17/4bb9490a7da02f33c83257aad381925c to your computer and use it in GitHub Desktop.
Attempt to document lookup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=head2 method lookup | |
method lookup(Metamodel::MethodContainer: $obj, $name --> Method) | |
Returns the first matching L<method|/type/Method> object of the provided C<$name>, | |
by following the L<mro|/type/Metamodel::C3MRO> of C<$obj>, or C<(Mu)> if no method | |
object was found. Note that C<lookup> is supposed to be used for introspection, | |
if you're after something which can be invoked you probably want to use | |
L<find_method|routine/find_method> instead. | |
say 2.5.^lookup("sqrt").perl: # OUTPUT: «method sqrt (Rat $: *%_) ...» | |
say Str.^lookup("BUILD").perl; # OUTPUT: «submethod BUILD (Str $: :$value = "", *%_ --> Nil) ...» | |
say Int.^lookup("does-not-exist"); # OUTPUT: «(Mu)» | |
Thx MasterDuke17, fixed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
"If no method object was not found", double negative