{"slug": "show-hn-modula-9-a-wirth-family-language-designed-for-auditing-ai-written-code", "title": "Show HN: Modula-9, a Wirth-family language designed for auditing AI-written code", "summary": "A developer publishing as atverm released Modula-9 (M9), a Wirth-family programming language whose compiler enforces type, failure-mode, effect and thread-safety checks that cannot be switched off, aimed at auditing code written by AI agents. The project reports runtime checks costing about 3%, Mandelbrot performance matching C from a 26 KB executable, a self-hosting compiler that produces byte-identical output, and a zarr reader matching numpy to the last digit; M9 was itself written by an agent under review. The compiler and tools ship under the GNU GPL version 3 with a runtime exception letting programs built with M9 be released under any license, with Linux packages for Ubuntu, Debian, Fedora, Rocky and Arch, and experimental macOS and Windows builds.", "body_md": "# A language for code that must be believed.\n\nM9 is a Wirth-family language that is readable like a bank statement and checked like Rust. Every rule exists because of a real bug, and the compiler refuses that bug instead of letting the program run on and quietly produce a wrong number.\n\n## For results you have to reproduce\n\nEvery number type names its width, and nothing converts on its own. A wrong conversion stops the program instead of slipping a bad value into your mean. The tutorial goes from first steps to a real ICOS CO2 series read through zarr, a NetCDF file, regressions, and threads.\n\n[Start the tutorial](https://tutorial.modula9.net)\n\n## For code an AI agent writes\n\nTypes, failure modes, effects, and thread safety are stated in definition modules, and the compiler checks them all. Checks can't be turned off. M9 was itself written by an agent under review, and its claims are checked the same way.\n\n[Read the report](https://github.com/atverm/m9c/blob/main/docs/M9-report.md)\n\n## Measured, not claimed\n\n- Runtime checks cost about 3%, and can't be switched off[Benchmarks](https://github.com/atverm/m9c/blob/main/docs/bench.md)\n- Mandelbrot runs as fast as C, from a 26 KB executable[Method](https://github.com/atverm/m9c/blob/main/docs/bench.md)\n- The compiler compiles itself to byte-identical output[Bootstrap](https://github.com/atverm/m9c#status)\n- The zarr reader matches numpy to the last digit[Chapter 8](https://tutorial.modula9.net/ch/08)\n- Each language feature cites the bug it makes uncompilable[The report](https://github.com/atverm/m9c/blob/main/docs/M9-report.md)\n\n## Install\n\nLinux: packages for Ubuntu, Debian, Fedora, Rocky, and Arch, or build from source with only gcc.\n\n```\n./build.sh\n```\n\nmacOS on Apple silicon, experimental.\n\n```\nbrew tap atverm/m9\nbrew install m9\n```\n\nWindows 10 and 11, experimental: a zip with its own gcc and one installer. [All releases](https://github.com/atverm/m9c/releases)\n\n## Resources\n\n## Your programs are yours\n\nThe compiler and tools are free software under the GNU GPL, version 3. The runtime and standard library carry a runtime exception, so programs you build with M9 can be released under any license you choose, open or proprietary. Changes to the compiler itself remain under the GPL.\n\n## Read the runtime exception\n\nThis file grants an additional permission under section 7 of the GNU General Public License, version 3. It applies to the Runtime Library of Modula-9, which consists of the C runtime (`runtime/m9rt.c` and `runtime/m9rt.h`, and the C files beside them in `runtime/`: the shims programs link and `m9session.c`), the standard library modules listed in `RUNTIME-LIBRARY-FILES`, and any code m9c copies from these into the C it generates.\n\nIt does not apply to the compiler m9c and its modules, the bootstrap C in `runtime/gen/`, or the tools (m9lsp, m9fmt, m9elide, the editor extension, and the Jupyter kernel). These remain under the GPL alone.\n\nThe permission is the GNU Classpath exception, reproduced verbatim, where “this library” means the Runtime Library:\n\nLinking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination.\n\nAs a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.\n\nCompiler output. The C code m9c generates from your program is not a work based on m9c merely because m9c produced it. Where that code contains material copied from the Runtime Library, the permission above covers that material.", "url": "https://wpnews.pro/news/show-hn-modula-9-a-wirth-family-language-designed-for-auditing-ai-written-code", "canonical_source": "https://www.modula9.net", "published_at": "2026-10-20 19:24:53+00:00", "updated_at": "2026-10-20 19:46:52.664361+00:00", "lang": "en", "topics": ["developer-tools", "ai-agents", "ai-safety", "artificial-intelligence"], "entities": ["Modula-9", "M9", "atverm", "m9c", "GNU GPL", "zarr", "numpy", "C"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/show-hn-modula-9-a-wirth-family-language-designed-for-auditing-ai-written-code", "markdown": "https://wpnews.pro/news/show-hn-modula-9-a-wirth-family-language-designed-for-auditing-ai-written-code.md", "text": "https://wpnews.pro/news/show-hn-modula-9-a-wirth-family-language-designed-for-auditing-ai-written-code.txt", "jsonld": "https://wpnews.pro/news/show-hn-modula-9-a-wirth-family-language-designed-for-auditing-ai-written-code.jsonld"}}