Last active
October 26, 2018 02:43
-
-
Save FCO/a61fbbcf0a498f80e04f95419b3325fb to your computer and use it in GitHub Desktop.
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 Exportable; | |
sub bla is exportable { 42 } | |
sub ble is exportable { 42 } | |
sub bli is exportable { 42 } | |
sub blo is exportable { 42 } | |
sub blu is exportable { 42 } |
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
sub EXPORT { | |
say "EXPORT"; | |
my Routine %funcs; | |
multi trait_mod:<is>(Routine \r, Bool :$exportable! where * === True) is export { | |
say "exportable => $exportable"; | |
trait_mod:<is>(r, :exportable(r.name)) | |
} | |
multi trait_mod:<is>(Routine \r, Str :$exportable!) is export { | |
dd %funcs; | |
say "exportable => $exportable"; | |
%funcs{ $exportable } = r | |
} | |
multi exported-EXPORT() { | |
{} | |
} | |
multi exported-EXPORT(Whatever --> Hash()) { | |
%funcs | |
} | |
multi exported-EXPORT(*@funcs --> Hash()) { | |
say "exported-EXPORT: @funcs[]; %funcs<>"; | |
%funcs{ @funcs }:p | |
} | |
say "returning"; | |
{ | |
'&EXPORT' => &exported-EXPORT | |
} | |
} |
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 lib "."; | |
use Bla <bla>; | |
#say bla; |
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
Hash[Routine] %funcs = (my Routine %) | |
Hash[Routine] %funcs = (my Routine % = :bla(sub bla { #`(Sub|140511307538080) ... })) | |
Hash[Routine] %funcs = (my Routine % = :bla(sub bla { #`(Sub|140511307538080) ... }), :ble(sub ble { #`(Sub|140511307538232) ... })) | |
Hash[Routine] %funcs = (my Routine % = :bla(sub bla { #`(Sub|140511307538080) ... }), :ble(sub ble { #`(Sub|140511307538232) ... }), :bli(sub bli { #`(Sub|140511307538384) ... })) | |
Hash[Routine] %funcs = (my Routine % = :bla(sub bla { #`(Sub|140511307538080) ... }), :ble(sub ble { #`(Sub|140511307538232) ... }), :bli(sub bli { #`(Sub|140511307538384) ... }), :blo(sub blo { #`(Sub|140511307538536) ... })) | |
EXPORT | |
returning | |
exportable => True | |
exportable => bla | |
exportable => ble | |
exportable => bli | |
exportable => blo | |
exportable => blu | |
exported-EXPORT: bla; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment