Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

julia

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 $
like image 731
Jeff Avatar asked Oct 23 '25 15:10

Jeff


1 Answers

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.

like image 174
StefanKarpinski Avatar answered Oct 25 '25 07:10

StefanKarpinski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!