From 5e40ffa8368ceed5b06c82e2171e84a5be0425ab Mon Sep 17 00:00:00 2001 From: tannevaled Date: Sun, 15 Nov 2026 12:06:04 +0100 Subject: [PATCH] Fortran cells run in the playground (v0.16.0) The Fortran page and the playground page said the playground core did not link the runtime yet; since playground v0.16.0 a Fortran cell runs in the second core, bounded to 200 million steps and 10 s. Co-Authored-By: Claude Sonnet 5.5 --- content/en/fortran.md | 10 ++++++++-- content/en/playground.md | 18 +++++++++++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/content/en/fortran.md b/content/en/fortran.md index 798604a..82ca176 100644 --- a/content/en/fortran.md +++ b/content/en/fortran.md @@ -62,8 +62,14 @@ initialisation. ## The playground -The playground's WebAssembly core does not link the Fortran runtime yet. -`fcells` builds for `js/wasm`; wiring it into the core is the playground's work. +Fortran cells run in the browser playground, with no server and no compiler: +the evaluator is linked into the playground's second WebAssembly core (the +one it loads for a notebook with a Fortran, R, Ruby or Julia cell), through +`fcells.Session.Eval`; the default core stays Go-only. The playground bounds a +cell tighter than the kernel does: 200 million DO iterations and procedure +calls, 10 s and 16 MiB of output per stream. An endless `do` ends with +`step limit reached: the cell ran too many loop iterations and calls` and the +page stays usable. The second core grew by 1.3 MB (0.28 MB gzipped). [examples/fortran.md](https://github.com/go-notebook/notebook/blob/main/examples/fortran.md) runs end to end: `notebook run examples/fortran.md`. diff --git a/content/en/playground.md b/content/en/playground.md index 364e50e..3845b01 100644 --- a/content/en/playground.md +++ b/content/en/playground.md @@ -8,8 +8,9 @@ tags: [playground] The [playground](https://go-notebook.github.io/playground/) runs a notebook in the browser, with no server. Go cells run in an interpreter compiled to -WebAssembly; Ruby cells run in [rbgo](https://github.com/go-embedded-ruby/ruby), and R cells in -[go-embedded-r](https://github.com/go-embedded-r/r). +WebAssembly; Ruby cells run in [rbgo](https://github.com/go-embedded-ruby/ruby), R cells in +[go-embedded-r](https://github.com/go-embedded-r/r) and Fortran cells in +[go-embedded-fortran](https://github.com/go-embedded-fortran/fortran). These are its controls from go-notebook/playground v0.6.0. The keys are Jupyter's, with the same meanings; every key has a button too, because a phone has no keyboard. @@ -81,7 +82,7 @@ On a narrow screen a cell's buttons fold behind **⋯**. ## Choosing and changing a language -**+ Add cell** asks what the new cell is: Go, Ruby, C, Julia, R or Markdown, +**+ Add cell** asks what the new cell is: Go, Fortran, R, Ruby, C, Julia or Markdown, the languages go-notebook registers. A C or Julia cell is parsed and checked, not run yet, and the menu says so (*C · not runnable yet*, *Julia · not runnable yet*); a cell that reads it is @@ -115,6 +116,17 @@ cell that goes past one is stopped with a message that says which. If the core crashes it is restarted, and the cell shows a message. The second core is about 4.5 MB larger. +## Fortran cells + +Since playground v0.16.0 a Fortran cell runs in the page, in the second core, +on [go-embedded-fortran](https://github.com/go-embedded-fortran/fortran)'s +evaluator, with no compiler. Fortran's variables, procedures and modules +persist from one Fortran cell to the next, and do not cross to the other +languages. A cell is bounded: **200 million** DO iterations and calls, **10 s** +and 16 MiB of output per stream; an endless `do` ends with a message that says +so and the page stays usable. The second core is about 1.3 MB larger. See +[Fortran cells](fortran.md). + ## Limits A notebook you open may come from anyone. The playground gives it: