Skip to content
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

Code caching and scope when importing libraries #369

Open
tlienart opened this issue Feb 19, 2020 · 1 comment
Open

Code caching and scope when importing libraries #369

tlienart opened this issue Feb 19, 2020 · 1 comment

Comments

@tlienart
Copy link
Owner

Consider:

A
```julia:init
using PlotlyJS
```
B
```julia:ex
some example
```

After the first pass, these two blocks will be cached and not re-evaluated. The issue however is that if we kill the server, add a new code block at the end of the document which requires Plotly, and restart the server, that last code block will fail because the initial code cell will not be re-evaluated and the module has been scraped so that it doesn't load PlotlyJS anymore.

The current way around this is to just use @def reeval = true but this is not the elegant option.

Several simple ways of doing things:

  1. use reeval=true (already works)
  2. add the using statement in every code block with a #hide, this has negligible cost if the library is already loaded and will ensure the issue doesn't arise

Non-simple way of doing things:

  • add some form of command to force a cell to always be reevaluated

this however entails that the scope would be stale after that cell and that everything would potentially need to be re-evaluated afterwards, so there's no clear advantage over just reeval = true I would think.

Another (difficult?) but nice way could be to make "permanent" any statement at least for the duration of the session... That would require:

@tlienart
Copy link
Owner Author

tlienart commented Apr 13, 2020

Good solution for this should be to put the imports in utils.jl , need to try first as it imports ..Utils, not using.

We could just go over the symbols loaded in Utils and load all those that are modules them in all submodules... (with the same paths so using/import)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant