From 1f9aacfbf1e7117c90fb9c59303aca11db8047c6 Mon Sep 17 00:00:00 2001 From: tannevaled Date: Sun, 15 Nov 2026 14:17:48 +0100 Subject: [PATCH] Julia cells: v0.19.0 text Variables cross with Go cells, soft scope, MethodError text, image v0.17.0, new known limitations. Co-Authored-By: Claude Sonnet 5.5 --- hugo.toml | 2 +- playground/notebooks/4-julia.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hugo.toml b/hugo.toml index fbc9d19..31d21d1 100644 --- a/hugo.toml +++ b/hugo.toml @@ -41,7 +41,7 @@ disableKinds = ['taxonomy', 'term', 'rss', 'sitemap', '404'] name = "notebook" kind = "kernel · command" href = "https://github.com/go-notebook/notebook" - blurb = "The kernel, the notebook command (run, html, watch, serve, irb) and the HTML export: format parses the Markdown, analysis builds the dependency graph from the syntax, gen writes the Go program, kernel compiles and drives it through runtime and keeps results and values, export writes the page. Ruby cells (```ruby) run on rbgo, a Ruby written in Go, with the go-scikit bindings (Stats, Special, Optimize, Integrate, DataFrame, Plot, NDArray), and share their variables with the Go cells. --timeout and --memory stop a runaway cell in either language. notebook irb is the same Ruby as an interactive session, as irb: => inspect after each input, _, multi-line input decided by rbgo's parser, Tab completion and history in a pure-Go line editor (go-ruby-reline), each input in a worker that --timeout, --memory or Ctrl-C can stop without losing the prompt, and --save to keep the session as a notebook. More → Julia cells (```julia) are parsed with go-embedded-julia's parser and checked (syntax errors at their line with julia's message, names in the dependency graph under Julia's scope rules), and, since go-notebook v0.18.0, run by its interpreter (v0.15.0) in one kernel shared by the Julia cells: a global or a function a cell defines is there in the next one, and a failure is julia's own text. The kernel boots from a prebuilt Base image, fetched on the first Julia cell and loaded only if its SHA-256 is the pinned one (cold start about a second). A cell may run 30 s and 50 million statements, within a memory budget of 512 MiB counted as 16 bytes per array element (a floor, not the heap: strings are not counted, and one array may have at most 2^24 elements). Julia variables stay in Julia, as R's do: they are not shared with Go, Ruby, R, C or Fortran cells in either direction yet. Known limitations: a loop at the top level of a cell cannot update a global (go-embedded-julia#54). The playground checks Julia cells and does not run them (Julia cells run in go-notebook, not yet in the browser). More → R cells (```r) are parsed with go-embedded-r's parser, identical to R 4.6.2 on R's own sources, and checked in the same way: syntax errors at their line in R's words, names in the graph, and a cell that cannot be analysed from its text (<<-, eval, library) depending on every cell above it. They run on go-embedded-r's evaluator in one shared environment (v0.10.0), and since v0.12.0 each cell is bounded: 512 MiB of vectors, 50 million steps, 30 s. The browser playground runs them too (playground v0.15.0), in its second core, with R variables kept apart from the other languages: 512 MiB, 20 million steps, 10 s per cell, and a crash restarts the core with a message on the cell. More → Fortran cells (```fortran) are checked and run with go-embedded-fortran (since go-notebook v0.17.0, go-embedded-fortran v0.17.0: its sema session for the names and errors, its eval.Session for the running; free form, implicit typing off) and highlighted with go-rouge's fortran lexer. The Fortran cells share one session: a cell sees the variables (with the values the earlier cells left), procedures, modules and derived types of the Fortran cells before it. Fortran variables stay in Fortran, as R's do: they are not shared with Go, Ruby, Julia, R or C cells in either direction yet. A cell may make at most 2^32 loop iterations and calls and run 30 s, and a failure is reported at its line and column. The browser playground runs them too (playground v0.16.0), in its second core, with Fortran variables kept apart from the other languages: 200 million steps and 10 s per cell, and an endless do ends with a message and leaves the page usable. More →" + blurb = "The kernel, the notebook command (run, html, watch, serve, irb) and the HTML export: format parses the Markdown, analysis builds the dependency graph from the syntax, gen writes the Go program, kernel compiles and drives it through runtime and keeps results and values, export writes the page. Ruby cells (```ruby) run on rbgo, a Ruby written in Go, with the go-scikit bindings (Stats, Special, Optimize, Integrate, DataFrame, Plot, NDArray), and share their variables with the Go cells. --timeout and --memory stop a runaway cell in either language. notebook irb is the same Ruby as an interactive session, as irb: => inspect after each input, _, multi-line input decided by rbgo's parser, Tab completion and history in a pure-Go line editor (go-ruby-reline), each input in a worker that --timeout, --memory or Ctrl-C can stop without losing the prompt, and --save to keep the session as a notebook. More → Julia cells (```julia) are parsed with go-embedded-julia's parser and checked (syntax errors at their line with julia's message, names in the dependency graph under Julia's scope rules), and, since go-notebook v0.18.0, run by its interpreter (v0.17.0, since go-notebook v0.19.0) in one kernel shared by the Julia cells: a global or a function a cell defines is there in the next one, a top-level loop updates a global as in IJulia (55 for a sum of 1 to 10), and a failure, a MethodError included, is julia's own text. The kernel boots from a prebuilt Base image, fetched on the first Julia cell and loaded only if its SHA-256 is the pinned one (cold start about a second). A cell may run 30 s and 50 million statements, within a memory budget of 512 MiB counted as 16 bytes per array element (a floor, not the heap: strings are not counted, and one array may have at most 2^24 elements). Julia variables cross with Go cells in both directions (Int64, Float64, Bool, String, and vectors and matrices of Float64 or Int64; Go int and []int as Int64): a Julia value of another type stays in Julia and the Go reader is deferred, naming the type, and a Go value Julia cannot take fails the Julia cell. Inputs are measured before any copy (2^24 elements per array, a cell's inputs together within its memory limit, so a cell can hold up to twice its limit). This breaks v0.18.0, where Julia variables were not shared. Known limitations: a Float64 A * x needs BLAS (go-embedded-julia#67), a non-ASCII uppercase needs utf8proc (#65), and Get refuses an n×0 matrix (#76). The playground checks Julia cells and does not run them (Julia cells run in go-notebook, not yet in the browser). More → R cells (```r) are parsed with go-embedded-r's parser, identical to R 4.6.2 on R's own sources, and checked in the same way: syntax errors at their line in R's words, names in the graph, and a cell that cannot be analysed from its text (<<-, eval, library) depending on every cell above it. They run on go-embedded-r's evaluator in one shared environment (v0.10.0), and since v0.12.0 each cell is bounded: 512 MiB of vectors, 50 million steps, 30 s. The browser playground runs them too (playground v0.15.0), in its second core, with R variables kept apart from the other languages: 512 MiB, 20 million steps, 10 s per cell, and a crash restarts the core with a message on the cell. More → Fortran cells (```fortran) are checked and run with go-embedded-fortran (since go-notebook v0.17.0, go-embedded-fortran v0.17.0: its sema session for the names and errors, its eval.Session for the running; free form, implicit typing off) and highlighted with go-rouge's fortran lexer. The Fortran cells share one session: a cell sees the variables (with the values the earlier cells left), procedures, modules and derived types of the Fortran cells before it. Fortran variables stay in Fortran, as R's do: they are not shared with Go, Ruby, Julia, R or C cells in either direction yet. A cell may make at most 2^32 loop iterations and calls and run 30 s, and a failure is reported at its line and column. The browser playground runs them too (playground v0.16.0), in its second core, with Fortran variables kept apart from the other languages: 200 million steps and 10 s per cell, and an endless do ends with a message and leaves the page usable. More →" [[params.repos]] name = "playground" kind = "wasm · page" diff --git a/playground/notebooks/4-julia.md b/playground/notebooks/4-julia.md index aa417a8..6f2cb37 100644 --- a/playground/notebooks/4-julia.md +++ b/playground/notebooks/4-julia.md @@ -15,7 +15,7 @@ xs = [i^2 for i in 1:3] total = sum(xs) ``` -Julia variables stay in Julia (they are not shared with Go cells, in either direction), so a cell of another language neither reads `total` nor waits for it. It runs as usual, whatever the Julia cells above it do: +In go-notebook itself, Julia variables cross to and from Go cells (Int64, Float64, Bool, String, and vectors and matrices of Float64 or Int64). Here the Julia cell is only checked, so a cell that reads no Julia name neither reads `total` nor waits for it. It runs as usual, whatever the Julia cells above it do: ```go n * 2