-
Notifications
You must be signed in to change notification settings - Fork 9
Fix begin/end replacement in varname expansion (fixes #23) #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I think it should work now. But there's even more gensyms in the doctests, which it isn't gonna like. |
|
Just make them evaluated expression rather than the generated julia> x = [[1.0, 2.0]]; eval(vinds(:(x[1][end])))
((1,), (2,)) |
Pull Request Test Coverage Report for Build 1062557433
💛 - Coveralls |
Codecov Report
@@ Coverage Diff @@
## main #25 +/- ##
==========================================
+ Coverage 83.05% 85.71% +2.66%
==========================================
Files 1 1
Lines 59 91 +32
==========================================
+ Hits 49 78 +29
- Misses 10 13 +3
Continue to review full report at Codecov.
|
|
Is this good for a review? |
|
@torfjelde Yes, I think so. |
torfjelde
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff! I've left a couple of comments, the most important one being that we should probably use Base.maybeview rathe than not.
IMO we should have integration tests for DPPL in AbstractPPL.jl, but for now, could you just run DPPL tests using this branch of APPL to verify that things work? In particular I'm curious about Julia 1.3.
Oh and could you bump the patch-version?
| Extract a list of lists of (raw) indices of an iterated `:ref` expression. | ||
| ```julia |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ```julia | |
| ```jldoctest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does that work with a non-exported function?
I had the same thought, but Hong recently told me they exist already: https://github.com/TuringLang/AbstractPPL.jl/blob/main/.github/workflows/IntegrationTest.yml. Is that enough? |
|
Oh yeah, crap. It's because we've bumped the minor version due to changes in |
|
Closed in favour of #26, which implements a superset of this functionality. |
The trick is to (1) first extract the indices, then replace the
begin/end, and (2) make use of the internalBase.replace_ref_(begin_)end_!, which lets you specify the replacement yourself.The latter seems a bit dubious, but I don't see another chance without a complete reimplementation of
Base.replace_ref_begin_end!. Any kind of recursive implementation will have that argument anyway, since you need to care about nested scopes, so it should be kinda stable... I hope.I'd also like to include a test of the following kind:
But those gensyms won't be liked by the doctests. Any idea how to nicely add it?
@torfjelde check it out.