Skip to content

Instantly share code, notes, and snippets.

@Tux
Created February 6, 2015 08:30
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Tux/eacf46e310aed15795d1 to your computer and use it in GitHub Desktop.
#!perl6
use v6;
use Slang::Tuxic;
class C {
method foo (Str $s) {
$s.say;
}
CHECK { "CHECK".say;
sub alias (Str:D $m, *@aka) {
my $r := C.^find_method ($m);
my $p := $r.package;
$p.^add_method ($_, $r) for @aka;
}
alias ("foo", < bar >);
alias ("foo", < buz wru >);
}
}
C.foo ("foo");
C.bar ("bar");
C.wru ("wru");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment