Julia metaprograms: "ERROR: unsupported or inappropriate $ expression"
Why am I getting the error below? (I'm new to metaprogramming in Julia.) Thanks.
julia> d = :e
:e
julia> macroexpand(:(b.$d))
:(b.e)
julia> macroexpand(:($d.c))
:(e.c)
julia> macroexpand(:(b.$d.c))
ERROR: unsupported or misplaced expression $
julia> macroexpand(:(b.$(d).c))
ERROR: unsupported or misplaced expression $
+3
source to share
1 answer
It was a bug, the problem was here:
https://github.com/JuliaLang/julia/issues/10997
This has been fixed since then. As pointed out in the comments to the question, there are some hacky workarounds if you get stuck on Julia's uncommitted version, but hopefully you can update.
+3
source to share