Jeff
Jeff

Reputation: 1242

Julia metaprogramming: "ERROR: unsupported or misplaced expression $"

Why am I getting the error message below? (I'm fairly 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 $

Upvotes: 4

Views: 363

Answers (1)

StefanKarpinski
StefanKarpinski

Reputation: 33300

This was a bug, issue filed here:

https://github.com/JuliaLang/julia/issues/10997

It has been fixed since. As indicated in the comments on the question, there are some hacky workarounds if you're stuck on an unfixed Julia version, but hopefully you can upgrade.

Upvotes: 4

Related Questions