Skip to content

Instantly share code, notes, and snippets.

@vrurg
Created November 22, 2020 20:29
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 vrurg/caeac11d7a2cb5f2c87d910a2df96c30 to your computer and use it in GitHub Desktop.
Save vrurg/caeac11d7a2cb5f2c87d910a2df96c30 to your computer and use it in GitHub Desktop.
role R[::T] {
my subset RS of T where { note "VALIDATING ", $_, ", T:", T.^name; True };
method the-subset { RS }
method foo(RS $vrs) {
pass "got value " ~ $vrs.raku
}
}
class C1 does R[Int] { }
my $obj = C1.new;
my $meth = $obj.^lookup('foo');
note "::: method parameter type: ", $meth.signature.params[1].type.^refinee.^name;
$obj.foo(12);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment