moonbit-docs
moonbit-docs copied to clipboard
The docs of MoonBit programming language
> In MoonBit, Int/Double etc. are compiler builtin types, so there is no need to export them: they are universally available, unqualified. > > Defining custom type with the same...
Moonbit support new [Attribute syntax](https://www.moonbitlang.com/weekly-updates/#attribute-syntax) since [2025-03-10](https://www.moonbitlang.com/weekly-updates/2025/03/10/index), [E1020 ](https://docs.moonbitlang.com/en/latest/language/error_codes/E1020.html) need to be updated
> we can bind this C function and pass closure to it using the following trick: current `moonc` insert `moonbit_incref` ouside the closure, but in FFI boundary `moonc` insert this...
To ensure the simplicity and consistency of MoonBit, design principles should be established early. This is crucial for the healthy development of MoonBit. If design principles are violated, they must...
[Number](https://docs.moonbitlang.com/en/latest/language/fundamentals.html#number) For simplicity and consistency, type names and definitions should be adjusted rather than rigidly following the conventions of outdated languages. The adjusted numeric types are shown in the table...
[Program entrance](https://docs.moonbitlang.com/en/latest/language/introduction.html) Why distinguish between the init and main functions? What are the benefits of doing this? Many MoonBit beginners have these questions, but it is not explained in the...
### Example ```moonbit let f : FuncRef[() -> Unit] = fn () { } fn main { f |> ignore } ``` ### Step ``` moon build ``` ### ICE...
when typing `#borrow` attribute, I think it also can trigger completion for parameters. 
```diff From 9e7620ef8e989a26bfcb3a9cb80c0629c469942e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8C=97=E9=9C=B2?= Date: Sun, 20 Apr 2025 11:32:04 +0800 Subject: [PATCH 2/2] support include by C++ --- moonbit-fundamental.h | 10 ++++++++++ moonbit.h...
top.mbt: ```moonbit struct X { a : &Eq } fn main { let _ : X = panic() } ``` run `moon build`, output: ``` failed: moonc link-core C:\Users\flycloudc\.moon\lib\core\target\wasm-gc\release\bundle\core.core D:\Code\moonbit\bug\project1\target\wasm-gc\release\build\project1.core...