You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would be interested in some clarification regarding RFC nim-lang/RFCs#44 (CC @mratsim): Is it by design that it is not possible to have a NimSym referring to a NimIdent?
Minimal example:
import macros
macrotypedMacro(body: typed): untyped=result=newProc(
ident"newTest",
[newEmptyNode(), newIdentDefs(ident"x", ident"int")],
body[0][6], # the original proc body
)
echoresult.repr
# Basically the macro generate a proc `newTest` with exactly the same signature.# However it uses a fresh ident to define `x`, but reuses the `x` symbol from the body.typedMacro():
proctest(x: int) =echo x
newTest(1) # interestingly the problem is only triggered IF we call the proc
The resulting AST shows the difference between ident and symbols:
I would be interested in some clarification regarding RFC nim-lang/RFCs#44 (CC @mratsim): Is it by design that it is not possible to have a
NimSym
referring to aNimIdent
?Minimal example:
The resulting AST shows the difference between ident and symbols:
This currently errors with:
Error: internal error: environment misses: x
The text was updated successfully, but these errors were encountered: