-
Notifications
You must be signed in to change notification settings - Fork 129
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
Symbols loaded after make() #253
Comments
For now, users can get around this by creating a custom |
I think this specific issue could be solved by just I'm not sure about the question of environments. I like way |
I'm not sure I agree. Some of these targets get really big, and automatically loading things could get really expensive. Sometimes people want to run
Unfortunately, that needs to happen first because sometimes targets conflict with imports, especially when users load targets from the cache to interact with the results.
Flatness is a good way to put it. It's a source source of a lot of struggle for |
Sorry, I meant both before and after all |
I thought about this one more, and I think our best options are the following (ranked according to my preference):
Just say the word and I will implement the first one. I may need more convincing on the other two. |
Consistency is king, but it looks like the first option might break existing user code. Maybe a variant of option 3 combined with lazy loading (=active bindings)? It doesn't matter if we load more than necessary as long as we're consistent in what we load. Anyway, this feels sufficiently low prio to me at this point, labeled accordingly. |
Maybe active bindings for all the targets in the cache with no revdeps? |
I'm really not sure what's best at this point. |
At the very least, this is documented in the What about a console message that lists the newly-loaded targets? |
I'm leaning towards loading always with active bindings. Do the active bindings work with caching, so that the second access is faster? |
You mean in-memory caching, right? I just made that happen in 2fc5932. Creating active bindings for all non-file targets in the cache should cover it. But awkwardly, the bindings would need to be destroyed/unloaded before the next |
But unloading bindings is cheap, and reloading them too if they are in the in-memory cache? |
I think so. |
At this point, my only concern is the read-only nature of active bindings. Is there a way to relax that with > make(drake_plan(x = 1))
> loadd(x, lazy = "bind")
> x <- 2
Error: Binding is read-only. |
Edit: just saw r-lib/R6#99. Not sure how users will feel about that. What about lazy loading with promises instead? |
Except that > x <- drake_plan(a = 1)
> make(x)
> clean(destroy = TRUE)
> make(x)
Error: key 'a' ('objects') not found So promises with |
The theory of functional programming, and also much of drake's philosophy, suggests that these variables should be read-only. But this turns the problem into something we may wish to do for a major release. (Also, I don't see how to fully support assignment with bindr. The variable would remain an active binding, and we'd have to store the value the user gave us somewhere. Yikes.) |
If we implement #296, no targets will be automatically loaded anymore, which will give us consistency here. |
FYI: as a side effect of #369, the symbols loaded after |
Good news. Agree it's good to be consistent regardless of the |
When running
make()
for a target, it is available in the global environment only if it is built during this run ofmake()
(with the default config). Can we implement a more consistent way of handling built targets?The text was updated successfully, but these errors were encountered: