hverr / Contextual.jl

Contextual language abstractions for Julia
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Need fixed variable name for Overdub struct in outline @contextualized macro #1

Open hverr opened 6 years ago

hverr commented 6 years ago

Currently the implementation uses a fixed variable name to reference to the Overdub struct when rewriting an outline @contextualized function

See: https://github.com/hverr/Contextual.jl/blob/21393e71cb5f23bae07902ba84d5923d2f5bd3e2/src/outline_contextual.jl#L23

hverr commented 6 years ago

Note: using the code below does not work, because the overdub mechanism with @generated functions apparently is not correctly recursively overdubbing

    insert!(b.args, 2, :($(contextSpec.varName) = $Contextual.context() :: $(contextSpec.ctxType)))

    # Output new function

    f[:name] = :(::$TinyCassette.Overdub{typeof($(f[:name])), $(contextSpec.ctxType)})
    esc(MacroTools.combinedef(f))