macro compile-time comparison with define-pragmas

2023-05-15 Thread PMunch
This is the correct reply. The `when foo == fooName.strVal` confusingly gets executed during the "compilation" of the macro itself. This means that the `fooName` argument doesn't yet have a value. By using an `if` statement within the macro you're still doing the check during compile-time since

macro compile-time comparison with define-pragmas

2023-05-15 Thread Calonger
Do a `if foo == fooName.strVal`

macro compile-time comparison with define-pragmas

2023-05-15 Thread aEverr
For getting the source file name

macro compile-time comparison with define-pragmas

2023-05-15 Thread JohnAD
Rather than explain at great length, a quick bit of source code showing what I want to do: # # program called with nim c -d:foo=bar test.nim # import std / macros const foo {.strdefine.} = "unknown" macro jerry(fooName: untyped): untyped = whe