Skip to content

Instantly share code, notes, and snippets.

@cygx
Last active August 8, 2019 15:16
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 cygx/23638f780f77ba032d21f600d8f7d2cd to your computer and use it in GitHub Desktop.
Save cygx/23638f780f77ba032d21f600d8f7d2cd to your computer and use it in GitHub Desktop.
role Constructor[*@params] {
method CALL-ME(::?CLASS:U: *@args where +@params) {
%_{@params} = @args;
self.bless: |%_;
}
}
multi trait_mod:<is>(Mu:U $_, :contor($params)!) {
.^add_role: Constructor[@$params];
}
class Point is contor<x y> {
has $.x;
has $.y;
}
say Point(1, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment