here' a code I want to compile:
macro defineSomething(amount:expr):stmt=
var amountInt = intVal(amount).int
# Boring staff
defineSomething(42);
It works perfectly. I have all I want inside my macro I can operate staff in my own way.
But then I think, that, It would be better to remove magic number to some const settings:
const MAGIC_AMOUNT:int = 42
# Whole lot of strings
defineSomething(MAGIC_AMOUNT)
This code fails. Because MAGIC_AMOUNT
literally is not integer value unlike 42
magic number.
So, how to get my variable value inside the macros in nim?