Created
October 25, 2016 12:00
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
use v6; | |
use lib '.'; | |
# - require will return the class with the same name as the module name | |
# - all lookups of modules loaded via required have to be dynamic | |
# - type names are imported at runtime and are not available for normal type checks | |
# - smart match between type objects and dynamic lookups works | |
subset C where ::('M::C'); | |
my C $context = try { | |
CATCH { default { .note } }; | |
require ::('M'); | |
::('M::C') | |
}; | |
dd $context.HOW.^methods.elems; | |
dd $context.HOW.shortname($context); |
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
unit module M; | |
class C is export { method m { 'method C::m' } }; | |
class D is export { method m { 'method D::m' } }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment