Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jonathanstowe/8642d30f2dab6527b5c4c65d4420aebb to your computer and use it in GitHub Desktop.
Save jonathanstowe/8642d30f2dab6527b5c4c65d4420aebb to your computer and use it in GitHub Desktop.
multi method role
role Zub[::T] {
proto method CALL-ME(|c) { * }
multi method CALL-ME(Mu:D $self) {
}
multi method CALL-ME(Mu:D $self, T $i) {
}
}
multi sub trait_mod:<is> (Method $m, :$foo!) is export {
$m does Zub[Int];
}
class Foo {
proto method bar(|c) { * }
multi method bar() is foo {
}
multi method bar(Int $o) is foo {
}
}
Foo.new.bar(1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment