A hypothetical use of "walkros", macros that don't fire on a call but rather on a code pattern
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
| intercept (Q::Infix::Add $op) { | |
| quasi { | |
| {{{ $op.right }}} + {{{ $op.left }}} ~ ", lol" # let's ignore the possible infinite regress from defining + with + | |
| } | |
| } | |
| say 40 + 2; # '42, lol' | |
| sub pause {} | |
| intercept (Q::Sub $sub where { #`[the sub has a trait "is cps"; handwave] }) { | |
| #`[ we split the sub up and do lots of funky things to it ] | |
| } | |
| sub foo() is cps { | |
| loop { | |
| say "one"; | |
| pause; | |
| say "two"; | |
| pause; | |
| } | |
| } | |
| foo(); # 'one' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment