You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow name and property interpolation in varnames (#54)
Implements #46.
Most of this is dependent on my [PR in Setfield.jl](jw3126/Setfield.jl#168) to allow interpolation of properties (so it works only if you `dev` that branch).
It's a bit of a hack though, since `parse_object_lens` behaves a bit weirdly when the innermost value of a lens chain is an interpolation:
```julia
julia> Setfield.parse_obj_lens(@q $name.a)
(:($(Expr(:escape, :_))), :((Setfield.compose)($(Expr(:escape, :name)), (Setfield.PropertyLens){:a}())))
julia> Setfield.parse_obj_lens(@q x.a)
(:($(Expr(:escape, :x))), :((Setfield.compose)((Setfield.PropertyLens){:a}())))
```
I'd be really nice to always get the latter form. (`@q` is just an ad-hoc macro to construct expressions preserving the `:$`.)
@jw3126, could you maybe look at this and suggest any better alternatives? Either how to implement this nicely in AbstractPPL.jl, or improvements I can add to my PR.
Co-authored-by: Xianda <[email protected]>
0 commit comments