Skip to content

Instantly share code, notes, and snippets.

@jnthn
Created August 22, 2009 11:37
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 jnthn/172753 to your computer and use it in GitHub Desktop.
Save jnthn/172753 to your computer and use it in GitHub Desktop.
multi trait_mod:<is>(AttributeDeclarand $a, $value, :$type-object-valued) {
my $accessor_name = $a.name.substr(2);
my $meth = method { self.defined ?? $value !! eval($a.name) };
$a.how.add_method($a.how, $accessor_name, $meth);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment