.mbt
MoonBit is a proprietary general-purpose programming language.[1][2] It is developed by a team led by Zhang Hongbo. One of the motivations behind MoonBit's creation was Zhang's belief that existing languages like Java, Go, and Rust do not fully leverage the security and speed advantages of the WebAssembly instruction set, particularly in cloud computing and edge computing. After its initial release with native WebAssembly support, MoonBit later added support for JavaScript, Native, and the LLVM backend.[3]
MoonBit was publicly released in August 2023 and is currently in its pre-beta stage.[3]
MoonBit follows the design principles of "fast, simple, and scale" and supports functional programming, parallel computing, procedural programming, and object-oriented programming styles.[4]
The language is strongly typed and data-oriented, with optimizations for runtime and compile-time performance as well as Wasm file size. It provides built-in tools for debugging, software testing, value tracing, AI-assisted programming, and code coverage analysis.[3]
MoonBit has a syntax similar to Rust and is a strongly typed language featuring pattern matching, static types, and type inference to enforce strict data type constraints. Unlike Rust, which does not use garbage collection, MoonBit includes a garbage collector and adopts the WasmGC proposal.[5][4]
According to its creator Zhang Hongbo, MoonBit draws inspiration from Go's philosophy of simplicity, avoiding unnecessary complexity in syntax.
MoonBit is designed to be a LLM-friendly programming language, using real-time semantic sampling. It ensures reliability in code generation through a secure type system, Wasm sandboxing, and dead code elimination.[3]
The "Hello, World" program in MoonBit:[3]
fn main { println("hello world!") }
At launch, MoonBit provided a web-based IDE along with a Visual Studio Code extension. The language's IDE and compiler share a unified codebase, allowing MoonBit to be a first-class language in Visual Studio Code due to its fault-tolerant type system.
MoonBit employs a multi-backend approach, optimizing for different targets, including WebAssembly, JavaScript, Native, and LLVM.[3]
MoonBit has a Visual Studio Code extension that provides out-of-the-box debugging, code completion, and tooltips.[3]
On September 26, 2023, IoT Thrust Seminar | Moonbit For Cloud And Edge Using Wasm was held at Hong Kong University of Science and Technology.[6]
The source code to the MoonBit compiler was made available as source-available software under MoonBit Public Source License, a SSPL, in December 2024.[7]
In November 2024, the MoonBit Global Programming Innovation Challenge Concludes at Hetao Shenzhen Park.[8]