-
-
Notifications
You must be signed in to change notification settings - Fork 65
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
Add documentation explaining scoping and work-arounds #227
Comments
This errors when you execute the notebook with Literate you mean? This is because Jupyter uses https://github.com/JuliaLang/SoftGlobalScope.jl so I guess Literate has to do the same for notebooks. |
I don't understand: if I run the code in a Jupyter cell it works perfectly fine. Is there a way to have Literate just create the notebook without running the cells? That is, so it will succeed even if the cells contain invalid code. |
Yes, because Jupyter (like the REPL) uses different scoping rules compared to regular Julia files. This is not the case when Literate runs the code.
Yes, pass |
Literate.notebook
than actual Jupyter notebookThis patch enables "soft" scoping rules (see e.g. https://github.com/JuliaLang/SoftGlobalScope.jl) for code execution (markdown and notebook output). This is enabled by default for Jupyter notebook output (to mimic how the IJulia kernel works), and disabled otherwise. Soft scope rules can be enabled/disabled with the `softscope :: Bool` configuration variable. Fixes #227.
This patch enables "soft" scoping rules (see e.g. https://github.com/JuliaLang/SoftGlobalScope.jl) for code execution (markdown and notebook output). This is enabled by default for Jupyter notebook output (to mimic how the IJulia kernel works), and disabled otherwise. Soft scope rules can be enabled/disabled with the `softscope :: Bool` configuration variable. Fixes #227.
This patch enables "soft" scoping rules (see e.g. https://github.com/JuliaLang/SoftGlobalScope.jl) for code execution (markdown and notebook output). This is enabled by default for Jupyter notebook output (to mimic how the IJulia kernel works), and disabled otherwise. Soft scope rules can be enabled/disabled with the `softscope :: Bool` configuration variable. Fixes #227.
This patch enables "soft" scoping rules (see e.g. https://github.com/JuliaLang/SoftGlobalScope.jl) for code execution (markdown and notebook output). This is enabled by default for Jupyter notebook output (to mimic how the IJulia kernel works), and disabled otherwise. Soft scope rules can be enabled/disabled with the `softscope :: Bool` configuration variable. Fixes #227.
This patch enables "soft" scoping rules (see e.g. https://github.com/JuliaLang/SoftGlobalScope.jl) for code execution (markdown and notebook output). This is enabled by default for Jupyter notebook output (to mimic how the IJulia kernel works), and disabled otherwise. Soft scope rules can be enabled/disabled with the `softscope :: Bool` configuration variable. Fixes #227.
I have a block of code like the following:
Literate won't let me make a notebook unless I add
global ret
inside the for-loop. Even though the final Jupyter notebook is happy without theglobal ret
.Since this is the very first notebook in an introductory course I don't really want to talk about scoping, especially when I only need it to compile the file.
The text was updated successfully, but these errors were encountered: