Skip to content

Instantly share code, notes, and snippets.

@tadzik
Created November 27, 2012 21:13
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 tadzik/4157055 to your computer and use it in GitHub Desktop.
Save tadzik/4157055 to your computer and use it in GitHub Desktop.
role MyRole {
has $!a;
method accessor { $!a }
}
class MyClass does MyRole {
method new($arg) {
self.bless(*, :a($arg))
}
}
say MyClass.new(3).accessor;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment