Created
September 22, 2014 14:54
-
-
Save jnthn/1b3903306db8ba5c8242 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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