Skip to content

Instantly share code, notes, and snippets.

@jnthn
Created September 22, 2014 14:54
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/1b3903306db8ba5c8242 to your computer and use it in GitHub Desktop.
Save jnthn/1b3903306db8ba5c8242 to your computer and use it in GitHub Desktop.
multi trait_mod:<is>(Attribute $attr, :$notted!) {
my $acc-name = $attr.name.substr(2);
$attr.package.HOW.add_method: $attr.package, 'not-' ~ $acc-name, method () {
not self."$acc-name"()
}
}
class A {
has $.x is notted;
}
my $o = A.new(x => True);
say $o.x;
say $o.not-x;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment