-
-
Save rayman22201/ffa0a3274800d4cefc11f1d3a25368a9 to your computer and use it in GitHub Desktop.
Macro Counting in Nim
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
import macros | |
static: | |
var countCall = 0 | |
macro countCalls(): untyped = | |
countCall = countCall + 1 | |
return countCall | |
let a = countCalls() | |
let b = countCalls() | |
let c = countCalls() | |
echo "final count : ", c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment