Live data from Hacker News

Moonbit: Fast, compact and user friendly language for WebAssembly

moonbitlang.com

131–140 of 162 posts

Re: Moonbit: Fast, compact and user friendly language for WebAssembly

#131
post #74

Earlier quoted context omitted.

Will the compiler be open sourced?

The source code will be publicly available when we reach beta status(things are moving too fast right now).

This sounds like you're planning to use Business Source License (https://www.hashicorp.com/blog/hashicorp-adopts-business-sou...). Did I get that right?

Re: Moonbit: Fast, compact and user friendly language for WebAssembly

#133
post #86
post #83

Earlier quoted context omitted.

It clearly states: it targets web assembly. So, this should answer your question I think

Well, you can do graphics programming in c++ or using a game engine and compile it to Webassembly.. So this language could definitely have a graphics library.

That's only because the host javascript which loads the WASM is exposing functions to do webgl stuff. When you use emscripten to compile C++ is to WASM, part of that equation is the JS runtimes that allow you to call translate openGL calls to Webgl, play sounds etc. It's possible to do with moonbit, but it would require some work on your part.

Re: Moonbit: Fast, compact and user friendly language for WebAssembly

#134
post #90

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

There are a few.. Zig compiles to webassembly and looks fairly C-like. You can also use Cheerp or Emscripten to compile C to WebAssembly (though they both assume you are targeting the browser).

Also +1 for Assemblyscript which is fairly C-ish. It's based on Javascript / Typescript but really works more like C if you are doing anything low level (also it doesn't support Closures etc).

Re: Moonbit: Fast, compact and user friendly language for WebAssembly

#136

Hi, 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

In the lexical closure doc example, why choose to show variable name shadowing? What is the purpose of `let x = 3` in the below?

let x = 3 func foo(x: Int) { fn inc() { x + 1 } // OK, will return x + 1 fn fail() { y + 1 } // fail: The value identifier y is unbound. }

`foo` also captures the global `x`, but shadows it with the parameter `x`.

Can `Generics` be generic - are there higher kinds? Are they all invariant, or do they have variance and if so what is the notation?

Maybe I missed it - can methods be destructured from structs? Can enums have methods?

Is there partial application for methods and functions?

Re: Moonbit: Fast, compact and user friendly language for WebAssembly

#137

Hi, 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

Very cool, I really love to see these new wasm native languages, very exciting.

Do you have any plans for a standard library? Build one specific for the language, or will perhaps try use or create/collaborate on a cross language standard library based on wasm component model? Is this even possible or good idea?

May I ask the toolchain you're using to build Moonbit?

Re: Moonbit: Fast, compact and user friendly language for WebAssembly

#138

Earlier quoted context omitted.

> Because Moonbit is a modern language, while AssemblyScript is carrying forward the mistakes of the past. 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…

Modern doesn't imply perfect — just that it uses recent advancements.

In most conversations, TypeScript generally seems to be considered a fairly "modern" language. TypeScript offers a variety of rather advanced type system features, and AssemblyScript is based on it, so by extension, AssemblyScript should be fairly "modern" too.

Based on the limited docs that are available[0], Moonbit appears to be using C++-style "generics" that are just simple template substitutions (no constraints), which is far less "modern" than what TypeScript offers.

Honestly, I don't think imprecise words like "modern" are particularly useful, helpful, or good for discussions like this. "Pattern matching" has been a feature of certain programming languages for decades, so is that truly a "modern" feature?

[0]: https://moonbitlang.com/docs/syntax/#generics

Post reply on HN