
louise
Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.
ADR 0049: std/file — whole-file reads and writes
Status: Proposed (2026-10-18); needs engineering review (#44).
Context
The HTTP demo could not serve a file: std had no file IO at all
(std/io is the console, std/os the environment). Meanwhile the
runtime grew a blocking pool (ADR 0005): externs can
be declared blocking, running on a few worker threads while the actor
waits, so a slow call never stalls a scheduler thread — its module doc
already named file IO as a motivation, and argon2 uses it for hashing.
Decision
A new module, std/file, with whole-file operations only:
pub fn read :: path: String -> Result<String, String> / <io> // UTF-8 checked
pub fn read_bytes :: path: String -> Result<Bytes, String> / <io>
pub fn write :: path: String content: String -> Result<(), String> / <io>
pub fn write_bytes :: path: String content: Bytes -> Result<(), String> / <io>
pub fn exists :: path: String -> Bool / <io> // a file, not a directory
pub fn size :: path: String -> Result<Int, String> / <io>
- Every operation is
/ <io>and reportsErrorwith the OS's message — the conventions ofstd/netandstd/tls(OS services);ffistays for foreign libraries. Nothing panics; a missing file isError("No such file or directory (os error 2)"). - All four externs are
blocking(runtime/louise_rt/src/fs.rs): they run on the blocking pool while the actor is parked. They never panic, perform or drop, as the pool requires; the interpreter implements them inline (std::fs), solouise runand interpreted tests see files too. - No sandbox. Which paths a request may reach is the program's
decision; the demo's
static_filerejects..and answers 404 for anything missing, mapping the extension to a content type (GET /static/robots.txtserves./static/robots.txt).
Not in v0
Directory listing, removal, rename, permissions, append, and handles with
streaming reads/writes. Streaming wants a Resource<File> design (close
semantics under the Perceus discipline and actor stops) and its own ADR
section when a use case asks for it.
Consequences
- Five touch points per extern, as
docs/runtime-abi.mdlists: the std@externs,louise_rt'sfs.rs,louise_rt.h, the interpreter, and the table inlouise_core::externs(markedblocking, which impliesmay_unwind) — cross-checked bylouise_codegen_c/tests/externs.rs. writenever creates directories;Resultkeeps that explicit.- The demo serves its pages as pug templates (ADR 0048) and its assets —
the stylesheet included — from disk under
/static/(GET /static/style.css→./static/style.css): a request path with..is a 404.