Last active
January 29, 2020 20:13
-
-
Save treyharris/0ce541c07a1f94b41af61207563e7807 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env perl6 | |
proto check_type($ --> Str) { * } | |
multi check_type(uint $var) { return "uint" } | |
multi check_type(Int $var) { return "Int" } | |
my uint $ui = 42; | |
say "Value is $ui"; # Value is 42 | |
say check_type($ui); # uint | |
say ".^name is {$ui.^name}"; # .^name is Int | |
say check_type($ui); # uint | |
# .abs autoboxes | |
say check_type($ui.abs); # Int | |
# abs() does not | |
say check_type(abs $ui); # uint |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment