-
-
Save jnthn/acad3207544f40b72be9 to your computer and use it in GitHub Desktop.
This file contains 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>(Method $meth, :$notted!) { | |
my $name = $meth.name; | |
$meth.package.HOW.add_method: $meth.package, 'not-' ~ $name, method () { | |
not self."$name"() | |
} | |
} | |
class A { | |
method x() is notted { | |
True | |
} | |
} | |
my $o = A.new(); | |
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