weekly 2024-01-15
MoonBit Updateβ
- Relaxed the syntax on the right-hand side of
match, allowing the appearance of single statements. The following syntax is now permitted:
match x {
A => return
B => return 1
C => i = i + 1
D => break
E => continue
F => while true {}
}
- Fix various bugs in the formatter, and resolve issues with missing curly braces and parentheses in the code after formatting. For example:
| Original Code | Before Fix | After Fix |
| | |
- Added a new experimental inline testing mechanism. The declaration format is
fn test_*. Inline tests need to be declared in regular.mbtfiles (instead of_test.mbt). They must not have any parameters or return types. For example, the following usage will result in an error:
Now, moon test will not only execute each test file ending with _test.mbt in every package, but also perform inline tests within each package.
Plugin Updatesβ
- Fixed bugs related to
newtype goto definitionandrename.
Build System Updatesβ
moon newnow adds default values for various options, allowing users to select default values by pressing Enter.
$ moon new
Enter the path to create the project (. for current directory) [default: myproject] >
Enter the create mode (exec or lib) [default: exec] >
Enter your username [default: username] >
Enter the package name [default: hello] >
Enter your license [default: Apache-2.0] >
Created my-project
moon.mod.jsonnow includeslicenseandrepositoryfields.licenseindicates the license used by the mooncakes.io, which must comply with the SPDX standard.

- Removed
moon check --daemon. moon publishnow includes an upload size limit, the upload size must be less than 16 MiB.
Otherβ
- On the Windows platform, the installation path has been changed from
~/.moonto~/.moon/bin, bringing it in line with other platforms.