The MoonBit Update——0624

Language Update

  • Support 32-bit unsigned integers

    let num = 100U // Literal for 32-bit unsigned integers requires the 'U' suffix
  • WASM Backend Export Improvements

    When exporting functions with a return type of Unit in the WASM backend, the exported function previously had a type of (result i32). Now, the MoonBit compiler will automatically generate and export a wrapper function with no return value.

  • moonbitlang/core API Consistency Adjustments

    • Unified forall/exist and all/any to all/any
    • Unified contains and member to contains

IDE Updates

  • Bug Fix

    Fixed a bug where the type prefix would be lost when renaming methods.

  • Enhancement

    Added autocomplete functionality for match clauses of try ... catch ... expressions.

Build System Updates

  • Diagnostic Information Rendering

    Added an experimental feature for rendering diagnostic information. This can be enabled by setting the environment variable MOON_RENDR=1.

  • Command Changes

    Changed the moon bench command to moon generate-build-matrix. The bench subcommand will be used for future purposes.

:bangbang:Please note that to be in line with the core library development, we will update on a daily basis in the next few weeks.

1 Like

Regarding the -> Unit wrapper, I’m not seeing this feature in the latest update.

Specifically, I’m running:

$ moon version
moon 0.1.20240624 (e25afbc 2024-06-24)

I run this command:

$ moon build --target=wasm --output-wat

and the generated .wat file contains this:

(func $$fantix/component-basic-example/main.hello.fn/7 (export "hello")
 (param $arg0/8 i32) (param $arg1/7 i32) (result i32)

Please note the (result i32) which I expected to be removed.
So I still get this error when running on the host:

Error: type mismatch for function `hello`: expected `[I32, I32] -> []` but found `[I32, I32] -> [I32]`

Any ideas what I’m doing wrong?

Here’s the example if you want to try running “make” yourself: componentize-mbt/examples/basic at master · gmlewis/componentize-mbt · GitHub

Also, please note that moon publish appears to be broken with this release:

glenn@glenn-MacM2Pro ~/src/ (gmlewis-master) $ moon publish
error: No such file or directory (os error 2)
glenn@glenn-MacM2Pro ~/src/ (gmlewis-master) $ moon version
moon 0.1.20240624 (e25afbc 2024-06-24)

Yeah, sorry about that. Our colleague cut the release too early such that it did not include the features promised in the Weekly Update. We will release a new version and it should contain the features.

1 Like

It’s probably due to the fact that moon upgrade didn’t work properly. Please try to reinstall with the download script.

1 Like

No problem. Thank you! Looking forward to it!

Yes, that fixed it. Thanks again!