Created
June 24, 2022 03:00
-
-
Save sdondley/e45a9ad0a32467f1df8150b1df80c769 to your computer and use it in GitHub Desktop.
trait_mod for automatically checking and modifying arguments to methods on the fly
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 sub trait_mod:<is>(Method $obj, Bool :$path-checked) { | |
$obj.wrap: -> $inv, $path, |c { | |
if $path.starts-with: $inv.root { | |
callsame; | |
} else { | |
callwith $inv, $inv.root ~ $path, |c; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment