Skip to content

Instantly share code, notes, and snippets.

@salortiz
Created April 14, 2016 21:05
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 salortiz/0f869e25934d1457ff05ac2d0ba41e25 to your computer and use it in GitHub Desktop.
Save salortiz/0f869e25934d1457ff05ac2d0ba41e25 to your computer and use it in GitHub Desktop.
role Zub[::T] {
proto method CALL-ME(|c) { * }
multi method CALL-ME(Mu:D:) {
note "Got nothing";
}
multi method CALL-ME(Mu:D: T $i) {
note "Got $i";
}
}
class Foo {
has $!bar = Mu.new;
method bar(|c) is rw {
($!bar but Zub[Int])(|c);
}
}
Foo.new.bar(1);
Foo.new.bar();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment