What is Modula-9?
Modula-9 (M9) is a Wirth-family programming language and compiler for people building software where numeric correctness, explicit failure behavior, and thread safety matter. Its rules make types, effects, failure modes, and concurrency expectations visible in module definitions, then check them during compilation. The compiler is available to try in a browser and can also be installed on Linux, macOS with Apple silicon, and experimental Windows 10 and 11. The project includes learning and editor tools.
Modula-9 Features:
Explicit Numeric Widths: Each number type specifies its width, and conversions must be written explicitly, so the compiler rejects accidental conversions instead of silently changing values.
Checked Module Contracts: Definition modules state types, failure modes, effects, and thread-safety properties; the compiler checks those declarations and does not offer a switch to turn checks off.
Persistent Runtime Checks: Runtime checks stay enabled, with an overhead of about 3% reported for the language.
Scientific Data Tutorial: The tutorial progresses from introductory steps to reading an ICOS CO2 series through zarr and a NetCDF file, then working with regressions and threads.
Browser Compiler Test: A test program that should never compile is checked on every compiler build, and users can run it in a browser without installing M9.
Editor And Notebook Tools: The project provides a VS Code extension, language server, Jupyter kernel, and Claude Code skills alongside the compiler.
Modula-9 Benefits:
Safer Numeric Results: Explicit widths and conversions help prevent an unnoticed type mismatch from changing a calculation before it reaches a result.
Clearer Code Review: Stated failure modes, effects, and thread-safety expectations give reviewers concrete properties to inspect in a module.
More Reproducible Analysis: The tutorial’s data workflow and explicit numeric rules support analysis where readers need to trace how reported values were produced.
Lower Trial Friction: Trying the compiler in a browser lets prospective users explore M9 before setting up a local installation.
Flexible Program Licensing: The runtime exception allows programs built with M9 to be distributed under open or proprietary terms, while the compiler remains GPL-licensed.
Use Cases:
Scientific Data Analysis: Use M9 to work through a CO2 time series read from zarr or NetCDF and carry out regressions with explicit numeric conversions.
Concurrent Programs: Build programs that use threads when the thread-safety expectations of modules need to be stated and checked by the compiler.
Reviewing Agent Code: Use M9 for code written by an AI agent when types, effects, failure modes, and thread safety need compiler-enforced review.
Learning Systems Programming: Follow the tutorial from basic language steps into data reading, regression, and threaded programming while trying examples in the browser.
Compiler Development: Work on a compiler that is written in M9 and can compile itself to byte-identical output, using that result as a check during development.

