Nim: Exclamation mark value before constant string

Reading the macro documentation ( http://nim-lang.org/docs/macros.html ) I came across this piece of code:

nnkIdent(!"echo")

      

I tried to find the meaning of the exclamation mark, but couldn't find anything in the Nim documentation.

So: what is the difference between "string"

and !"string"

in Nim?

+3


source to share


1 answer


The exclamation point in this context is the syntax of the macro that creates the identifier. Here is the definition:

proc `!`(s: string): NimIdent {.magic: "StrToIdent", noSideEffect.}

      



builds id from string s

+4


source







All Articles