I’ve been considering trying my hand at a C-like WASM language, with most features mapping directly to WASM instructions. Surprised no one’s done something like that yet. Very cool tech
Moonbit: Fast, compact and user friendly language for WebAssembly
101–110 of 162 posts
Re: Moonbit: Fast, compact and user friendly language for WebAssembly
#102Re: Moonbit: Fast, compact and user friendly language for WebAssembly
#103Re: Moonbit: Fast, compact and user friendly language for WebAssembly
#104The site compares it to Rust and Go but to me the comparison is AssemblyScript. It’s also WASM-native and new with relatively little ecosystem around it. But compared to Moonbit it’s a familiar language to anyone that’s used TypeScript. So why use Moonbit over AssemblyScript?
Because Moonbit is a modern language, while AssemblyScript is carrying forward the mistakes of the past. For example, Moonbit supports pattern matching and most language constructs are expressions. AS doesn't have pattern matching and consists primarily of statements. Moonbit has algebraic data types; it's not clear to me that AS does. There might be other differences at runtime, but it's difficult to tell from just…
No language has "no mistakes".
For instance, let's take a language like Scala, which appeared 20 years ago. Has it avoided mistakes of the past? Or lets take Rust, which appeared 8 years ago. Is it "perfect"? Same with Moonbit; it will make tradeoffs and mistakes and whatnot.
Mistakes are not always technical in nature either. They can be mistakes in positioning, strategy, community, governance, poor documentation, etc.
Re: Moonbit: Fast, compact and user friendly language for WebAssembly
#105Hi, I am the lead of this project, you can try it now with our online IDE, https://try.moonbitlang.com (F5 to run) The docs are available https://github.com/moonbitlang/moonbit-docs , the compiler would be publicly available when we reach the beta status (expected to be the end of Q2 in 2024). Feel free to ask me any question
I'm picking nits. Overall I like it.
Re: Moonbit: Fast, compact and user friendly language for WebAssembly
#106Earlier quoted context omitted.
It clearly states: it targets web assembly. So, this should answer your question I think
> It clearly states: it targets web assembly. So, this should answer your question I think Not sure what you're implying. Here's an example of doing graphics using Rust and WASM - http://cliffle.com/blog/bare-metal-wasm/#making-some-pixels And another: https://blog.logrocket.com/implement-webassembly-webgl-viewe... Given that MoonBit is developing their own IDE and it is hosted on the web, I would think one could pro…
1. The host calls an exported WASM function
2. The WASM runtime runs code that calls an imported function
3. The host reads/writes the WASM runtime's memory/globals
In your example, the WASM build process spits out two artifacts - a WASM module and a JS module. The JS module defines the actual JavaScript host functions that manipulate the canvas, and then exposes those functions to the WASM instance.
Re: Moonbit: Fast, compact and user friendly language for WebAssembly
#107Earlier quoted context omitted.
It clearly states: it targets web assembly. So, this should answer your question I think
> It clearly states: it targets web assembly. So, this should answer your question I think Not sure what you're implying. Here's an example of doing graphics using Rust and WASM - http://cliffle.com/blog/bare-metal-wasm/#making-some-pixels And another: https://blog.logrocket.com/implement-webassembly-webgl-viewe... Given that MoonBit is developing their own IDE and it is hosted on the web, I would think one could pro…
Maybe the case of Makepad will interest you then: https://news.ycombinator.com/item?id=36567681
Re: Moonbit: Fast, compact and user friendly language for WebAssembly
#108Earlier quoted context omitted.
Yeah, Go has to embed the whole runtime and that amkes for huge payloads. I'm interested in your experience as I've been working on wasm SPA with Go. How does it crash? Seems to me that there are examples of stable webapps (for instance using go-app). Were you using a framework or raw syscall/js call? Have you tried compiling with tinyGo?
I've been using my own wrapper/library around syscall/js. It crashes mostly due memory issues/allocation. My own app worked fine until a point and then it started crashing. I applied several temporary fixes by limiting the amount of memory it allocates at start-up. Then optimised various libs to use less memory such: - instead of generating the html in pure Go using x/html package and applying it to the DOM later I c…
I've had to implement a few free-lists myself and went for allocation hunt.
Perhaps it's a memory leak somewhere.
If you have some code example, maybe I can have a look.
Re: Moonbit: Fast, compact and user friendly language for WebAssembly
#109Hi, I am the lead of this project, you can try it now with our online IDE, https://try.moonbitlang.com (F5 to run) The docs are available https://github.com/moonbitlang/moonbit-docs , the compiler would be publicly available when we reach the beta status (expected to be the end of Q2 in 2024). Feel free to ask me any question
Re: Moonbit: Fast, compact and user friendly language for WebAssembly
#110Earlier quoted context omitted.
Is having a dedicated fn keyword necessary? I mean, what’s the fundamental difference between a func and a fn ?
Not strictly necessary, we are not decided on it. For func the annotation is required, while fn does not need any type annotation