-
Notifications
You must be signed in to change notification settings - Fork 35
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
Support incremental evaluation in split_expressions
#406
Conversation
`split_expressions` assigns expressions to different modules. However, once assigned, the original order cannot be reconstructed. timholy/Revise.jl#475 is a case where expressions need to be `eval`ed in order, and it seems that the only correct place to put this capability is in`split_expressions`. This also improves consistency in handling top-level expressions.
Fascinating. Turns a |
It looks like the only packages using it are Atom and Revise. So unless it breaks existing versions of Atom / Revise I would personally just make it a patch release. |
I hadn't checked explicitly (good idea, thanks), but sure enough it's badly breaking for Revise. |
Codecov Report
@@ Coverage Diff @@
## master #406 +/- ##
==========================================
- Coverage 87.70% 87.47% -0.24%
==========================================
Files 11 11
Lines 2009 2099 +90
==========================================
+ Hits 1762 1836 +74
- Misses 247 263 +16
Continue to review full report at Codecov.
|
I'm more interested in doing this right than rushing it, so I plan to leave this open until @KristofferC has had a moment to catch his breath and think about it. (I am sure your task list is long and includes big-ticket items like, "get Julia 1.5 out" which I strongly support.) When there's time to think about it, here are a few more thoughts:
|
I'm reconsidering this (and it may take a while), so for the time being don't merge. |
timholy/Revise.jl#475 involves a couple of issues. With timholy/Revise.jl#497 on the way, the big obstacle is how Revise organizes its information: it first parses a file, splits the expressions out into modules, and then inserts them into a Dict as keys. The actual evaluation from
includet
(currently) iterates over the Dict keys.The problems with this design are that (1) when an expression is repeated exactly, you still only get one key/value pair in the Dict, and (2) order information is lost (other than the fact that these are SortedDicts) in terms of the order in which expressions in different modules should be executed. In a way it's kind of amazing that the old system worked as well as it did.
To fix this properly, it seems that the best strategy is to evaluate as you go, mimicking
include
. To me it seemed that the best place to put this issplit_expressions
, so now there's a new keywordeval::Bool
. I also took the occasion to clean up how:toplevel
expressions are handled and be more expansive in saving LineNumberNodes, thinking that given issues like timholy/Revise.jl#437 and similar that we'd rather not risk losing location information.Technically, changing the output of
split_expressions!
this way is a breaking change, so perhaps we should go to version 0.8. How do folks feel about that? There's always a certain amount of Pkg-churn when we make incompatible releases, but for this package I don't think it's too bad.