Skip to content

Instantly share code, notes, and snippets.

@Tux
Created February 6, 2015 08:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tux/22f8ced78cf9dc87db69 to your computer and use it in GitHub Desktop.
Save Tux/22f8ced78cf9dc87db69 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);
for @aka -> $alias {
$r.package.^add_method ($alias, $r);
}
}
alias ("foo", < bar >);
alias ("foo", < buz wru >);
}
}
C.foo ("foo");
C.bar ("bar");
C.wru ("wru");
=>
CHECK
foo
Cannot find method 'postcircumfix:<( )>'
in block <unit> at x.pl:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment