Weird Eval Problem / Help needed

julia> mydict =  Dict{Symbol,Any}()
Dict{Symbol,Any} with 0 entries

julia> mydict[:m] = 100
100

julia> eval(:($(Expr(:escape, :(mydict[:m])))))
ERROR: syntax: invalid syntax (escape (call (outerref getindex) (outerref mydict) (inert m)))
Stacktrace:
 [1] eval(::Module, ::Any) at ./boot.jl:235
 [2] eval(::Any) at ./boot.jl:234

Hi fellows, I am getting the following error, but i can’t figure out why.

What is the actual use case? What exactly are you trying to accomplish?

+1 to describing your use-case, or at least an example which is self-explanatory.

Escape (usually used through the esc-function) is only allowed in a macro:


help?> esc                                                                                                                                                               
search: esc escape_string unescape_string getsockname intersect intersect! hessfact hessfact! DenseVector DenseVecOrMat mutable struct typeintersect SparseMatrixCSC     

  esc(e::ANY)

  Only valid in the context of an Expr returned from a macro. Prevents the macro hygiene pass from turning embedded variables into gensym variables. See the Macros      
  section of the Metaprogramming chapter of the manual for more details and examples.