-
Notifications
You must be signed in to change notification settings - Fork 115
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
Common evaluation of multiple code blocks #859
Comments
Hello @SimonCoste All code blocks on the same page are executed as if they were part of one big notebook and so, in particular, share scope. You can see this in the following short example:
I added a few line returns to make it easier to see what's going on. As you can see, the second cell gets evaluated fine and shows its output (5). Note: the shortcut with an exclamation mark is just for when you don't want to name code cells and say "just evaluate this and show the output immediately after". You don't have to use this, especially if you want to place the result somewhere else than immediately after. Important corner caseAt the moment Franklin's caching is a bit clumsy. So if you're running on the same page and doing stuff, it will generally be fine, but if you return to that page and had defined your If this seems silly, I'm working on it right now and it should be fixed soon but it's part of some significant (and non trivial) refactoring. One way to avoid this is to mark a page as "re-eval everything each time" by adding the page variable
the only reason why you would not want to use that everywhere is that it slows down the processing of a page (since you evaluate all code cells, every time, even when you don't change the code). What I sometimes do is toggle it on and off when I see stuff go stale and some cell failing. |
Bonjour Thibaut, |
Avec plaisir, et ca m'a fait plaisir de découvrir dataflowr en passant ;-) |
Hi, I have a question regarding code evaluation in franklin.
Suppose that I have two distinct code blocks, say
and
Franklin's code evaluation will create two script files in
__site/assets/path/to/script/code/b1.jl
and.../b2.jl
, and so in my case, the second block will not compile because it needs access to the functionf
which is defined in the first script. To circumvent this, I use the following trick:inside the second block, and I hide the include line. I find this not very elegant, and possibly clumsy if I have tens of code blocks with complex dependencies.
Is it possible to evaluate the code in different blocks, but in the same script (for example) ?
The text was updated successfully, but these errors were encountered: