-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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]>
- Loading branch information
1 parent
e57ebca
commit 69e3924
Showing
2 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters