# Development

**URL:** https://discuss.moonbitlang.com/c/development/6.md

[Latest](https://discuss.moonbitlang.com/latest.md) · [Categories](https://discuss.moonbitlang.com/categories.md) · [Tags](https://discuss.moonbitlang.com/tags.md)

---

## [About the Development category](https://discuss.moonbitlang.com/t/about-the-development-category/17)

<div class="topic-metadata">

**Author:** [@Hoey](https://discuss.moonbitlang.com/u/Hoey)\
**Replies:** 0

</div>

The Development category is a dedicated place for more general discussions about the Moonbit programming language and toolchain. Contributors may open new topics to discuss potential changes / features and development t…

---

## [Add \`include path\` and \`lib path\` when building with native backend](https://discuss.moonbitlang.com/t/add-include-path-and-lib-path-when-building-with-native-backend/373)

<div class="topic-metadata">

**Author:** [@yoyocat](https://discuss.moonbitlang.com/u/yoyocat)\
**Replies:** 0\
**Last updated:** [August 10, 2025, 1:03am UTC](https://discuss.moonbitlang.com/t/add-include-path-and-lib-path-when-building-with-native-backend/373 "2025-08-10T01:03:35Z")

</div>

Such as title, is there a way to add additional include path and lib path when building with native backend? In case some third party libs are no source code available.

---

## [Getting involved + a couple of questions](https://discuss.moonbitlang.com/t/getting-involved-a-couple-of-questions/371)

<div class="topic-metadata">

**Author:** [@dhkf](https://discuss.moonbitlang.com/u/dhkf)\
**Replies:** 0\
**Last updated:** [August 3, 2025, 2:08am UTC](https://discuss.moonbitlang.com/t/getting-involved-a-couple-of-questions/371 "2025-08-03T02:08:04Z")

</div>

hi, just getting into moonbit after having followed it at a glance. for me, it’s nearing the perfect language (sort of rust + gc). i’ll mainly be targeting the js backend so my perspective is sort of getting things runni…

---

## [Unable to call other trait methods in \`impl Trait with ...\`?](https://discuss.moonbitlang.com/t/unable-to-call-other-trait-methods-in-impl-trait-with/268)

<div class="topic-metadata">

**Author:** [@lynzrand](https://discuss.moonbitlang.com/u/lynzrand)\
**Replies:** 0\
**Last updated:** [July 13, 2024, 12:30pm UTC](https://discuss.moonbitlang.com/t/unable-to-call-other-trait-methods-in-impl-trait-with/268 "2024-07-13T12:30:32Z")

</div>

This does not work: trait UnderlyingBuffer { read\_u8(Self, Int) -\> Byte? read\_u16\_be(Self, Int) -\> Int? } impl UnderlyingBuffer for Bytes with read\_u8(self, idx : Int) -\> Byte? { if idx \< 0 || idx \>= self.length(…

---

## [Generic traits not supported?](https://discuss.moonbitlang.com/t/generic-traits-not-supported/214)

<div class="topic-metadata">

**Author:** [@jayphelps](https://discuss.moonbitlang.com/u/jayphelps)\
**Replies:** 3\
**Last updated:** [April 28, 2024, 2:37am UTC](https://discuss.moonbitlang.com/t/generic-traits-not-supported/214 "2024-04-28T02:37:39Z")

</div>

Today generic traits don’t seem to be supported. Is that accurate or is the syntax different?

---

## [Support for Binaryen's wasm-opt](https://discuss.moonbitlang.com/t/support-for-binaryens-wasm-opt/209)

<div class="topic-metadata">

**Author:** [@jayphelps](https://discuss.moonbitlang.com/u/jayphelps)\
**Replies:** 1\
**Last updated:** [April 23, 2024, 2:27am UTC](https://discuss.moonbitlang.com/t/support-for-binaryens-wasm-opt/209 "2024-04-23T02:27:56Z")

</div>

Right now binaries created by moonbit utilize the Wasm feature of block / if / loop / try parameters e.g. (if (result i32) ...). While valid Wasm (it came from the multi-value proposal) unfortunately Binaryen’s superb op…

---

## [Are circular packages supported?](https://discuss.moonbitlang.com/t/are-circular-packages-supported/208)

<div class="topic-metadata">

**Author:** [@jayphelps](https://discuss.moonbitlang.com/u/jayphelps)\
**Replies:** 2\
**Last updated:** [April 22, 2024, 2:07am UTC](https://discuss.moonbitlang.com/t/are-circular-packages-supported/208 "2024-04-22T02:07:48Z")

</div>

The type system seems to accept it in vscode, but when I go to compile it says it can’t find one of them.

---

## [FFI and functions and/or closures](https://discuss.moonbitlang.com/t/ffi-and-functions-and-or-closures/210)

<div class="topic-metadata">

**Author:** [@jayphelps](https://discuss.moonbitlang.com/u/jayphelps)\
**Replies:** 1\
**Last updated:** [April 22, 2024, 1:58am UTC](https://discuss.moonbitlang.com/t/ffi-and-functions-and-or-closures/210 "2024-04-22T01:58:07Z")

</div>

pub fn schedule\_timeout(callback : () -\> Int, delay : Int) -\> Unit = "env" "schedule\_timeout" When I attempt to use the FFI to directly pass a function or closure I get Invalid stub type. I assume that’s because doing s…

---

## [How to create and compile a standalone library?](https://discuss.moonbitlang.com/t/how-to-create-and-compile-a-standalone-library/202)

<div class="topic-metadata">

**Author:** [@jayphelps](https://discuss.moonbitlang.com/u/jayphelps)\
**Replies:** 1\
**Last updated:** [April 15, 2024, 3:33am UTC](https://discuss.moonbitlang.com/t/how-to-create-and-compile-a-standalone-library/202 "2024-04-15T03:33:06Z")

</div>

In early versions of the toolchain I was able to do moon build --target wasm-gc to generate a generic Wasm library I could link into other Wasm modules or consume from any Wasm runtime. Now I get error: no package need t…

---

## [Handling strings in moonbit](https://discuss.moonbitlang.com/t/handling-strings-in-moonbit/113)

<div class="topic-metadata">

**Author:** [@luciodj](https://discuss.moonbitlang.com/u/luciodj)\
**Replies:** 5\
**Last updated:** [February 20, 2024, 7:04am UTC](https://discuss.moonbitlang.com/t/handling-strings-in-moonbit/113 "2024-02-20T07:04:51Z")

</div>

I see the compiler understands the type Char (still undocumented), how do you envision it being used? For example, how would you create a string constructor that can take a Char as input?

---

## [Return in while loop is not expected behaviour](https://discuss.moonbitlang.com/t/return-in-while-loop-is-not-expected-behaviour/161)

<div class="topic-metadata">

**Author:** [@Mng12345](https://discuss.moonbitlang.com/u/Mng12345)\
**Replies:** 1\
**Last updated:** [February 20, 2024, 6:21am UTC](https://discuss.moonbitlang.com/t/return-in-while-loop-is-not-expected-behaviour/161 "2024-02-20T06:21:41Z")

</div>

playground type ParsedValue\[V\] Result\[(V, String), String\] struct Lexer\[V\] { parse: (String) -\> ParsedValue\[V\] } fn Lexer::and\[V1, V2\](self: Lexer\[V1\], lexer2: Lexer\[V2\]) -\> Lexer\[(V1, V2)\] { fn parse(str: String)…

---

## [How to throw an exception?](https://discuss.moonbitlang.com/t/how-to-throw-an-exception/160)

<div class="topic-metadata">

**Author:** [@Mng12345](https://discuss.moonbitlang.com/u/Mng12345)\
**Replies:** 1\
**Last updated:** [February 20, 2024, 1:43am UTC](https://discuss.moonbitlang.com/t/how-to-throw-an-exception/160 "2024-02-20T01:43:18Z")

</div>

I can not find the part of exception in the moonbit documentation, just only use Result is not enough, we also need somthing like panic in Rust.

---

## [Moonbit on the server](https://discuss.moonbitlang.com/t/moonbit-on-the-server/88)

<div class="topic-metadata">

**Author:** [@iansmith](https://discuss.moonbitlang.com/u/iansmith)\
**Replies:** 5\
**Last updated:** [December 13, 2023, 1:25pm UTC](https://discuss.moonbitlang.com/t/moonbit-on-the-server/88 "2023-12-13T13:25:25Z")

</div>

Has anybody gotten moonbit code to run on wasmtime, wasmedge, or wazero? I’d like to use moonbit on the server and these are some of the popular options for that. Also, these types of wasm engines don’t really need a s…

---

## [Passing structures (objects/arrays) from wasm to javascript](https://discuss.moonbitlang.com/t/passing-structures-objects-arrays-from-wasm-to-javascript/100)

<div class="topic-metadata">

**Author:** [@retorquere](https://discuss.moonbitlang.com/u/retorquere)\
**Replies:** 1\
**Last updated:** [November 9, 2023, 2:39am UTC](https://discuss.moonbitlang.com/t/passing-structures-objects-arrays-from-wasm-to-javascript/100 "2023-11-09T02:39:38Z")

</div>

Are there examples of moonbit code that construct structs/objects/arrays and pass them back to javascript?

---

## [Mac Intel release](https://discuss.moonbitlang.com/t/mac-intel-release/47)

<div class="topic-metadata">

**Author:** [@retorquere](https://discuss.moonbitlang.com/u/retorquere)\
**Replies:** 3\
**Last updated:** [November 9, 2023, 2:38am UTC](https://discuss.moonbitlang.com/t/mac-intel-release/47 "2023-11-09T02:38:30Z")

</div>

Hi, May I ask why there’s only a m1 release? I thought xcode would compile to multiple targets without change?
