Lumina – a statically typed web-native language for JavaScript and WASM (github.com)

by light_ideas 25 comments 58 points
Read article View on HN

25 comments

[−] light_ideas 36d ago
Lumina is a statically typed, web-native language that compiles to JavaScript and WebAssembly. It has HM type inference, algebraic types, traits, a reactive UI runtime, a REPL, an LSP, and a browser demo written in Lumina itself. The current demo runs without React and uses a Vite plugin that compiles .lm files directly for the browser.

GitHub: https://github.com/nyigoro/lumina-lang npm: https://www.npmjs.com/package/lumina-lang

I’d love feedback on the language design, the web-native direction, and the developer experience.

[−] gwbas1c 31d ago
The first thing you can do is improve your "first impression" in your docs. None of the references to other pages are clickable hyperlinks; which markdown supports without much effort. (Pretty much got me to give up reading because it's the 21st century and hyperlinks have been around for at least 30 years.)

The second thing is to have a general overview of the features of the language on the first page that's a little more then just hello world. Have a loop, a variable, ect. I shouldn't have to "work" to get a feel for what's different and special about your language compared to vanilla Javascript, Typescript, Rust (via WASM,) C# (via WASM) and the countless other transpiled or WASM-compiled languages.

[−] pjmlp 31d ago
And for any ML inspired language, OCaml, Haskell, Grain, Roc.

Especially Grain, as it was also developed as an ML for WebAssembly.

[−] sjrd 31d ago
Have you tried Scala? It checks all the boxes, and is a mature language. The reactive UI runtime is provided by the library Laminar [1].

Technically its type inference is not HM but it's as expressive. In particular it has GADTs and HKTs, which I saw in your docs.

I wonder what you feel is missing from Scala (its .js/Wasm version) that Lumina provides?

[1] https://laminar.dev/

[−] spankalee 31d ago
Nice! I'm working on a similar language in some ways.

One decision I made is to specifically not compile to JS. JS/Wasm interop is good enough with Wasm GC that I made the choice to focus on Wasm-only constraints and semantics and not worry about how things like the types being wrong, or how ints translate to JS, how to handle null vs undefined, etc. JS GCs collect objects and cycles across the Wasm boundary, and with the JS string built-ins you can handle strings efficiently.

I couldn't load your demo, btw.

[−] austinrm 31d ago
As a longtime Typescript user working more recently in Rust, I appreciate the syntax and overall language design.

Like others in the comments, I’m wondering where this fits into the existing ecosystem. What kinds of problems does Lumina solve especially well vs. Typescript, or a WASM-compatible language?

[−] satvikpendem 31d ago
Or even ReasonML
[−] muizelaar 31d ago
Do you have benchmarks of the Wasm performance compared to other languages?
[−] Simon-curtis 31d ago
on the examples page, the example for string interpolation is a simple function example
[−] woadwarrior01 31d ago
Seems like a front-end bug. Click on the tab brings up the right example.

https://nyigoro.abrdns.com/#lumina

[−] mapcars 31d ago
It would be helpful to show some clarification on what the benefits are compared to TypeScript
[−] ezst 31d ago
Or the plethora of languages compiling to WASM, for that matter
[−] iddan 31d ago
Syntax looks cool. Would have expected proper syntax highlighting in the website (and plugin for IDEs). The website is currently too convoluted until you see actual syntax would highly suggest having code block at the front. See for good reference the landing page of ruby: https://www.ruby-lang.org/en/
[−] jasonjmcghee 31d ago
I see syntax highlighting on the website fwiw
[−] tegeek 31d ago
A good effort, but i failed to see any use case why someone will select Lumina over TypeScript. Infact Lumina itself is written in TypeScript.
[−] afavour 31d ago
Surely the ability to compile your WASM is a pretty big benefit over TypeScript, if it’s something you need.
[−] pjmlp 31d ago
AssemblyScript exists.
[−] spankalee 31d ago
AssemblyScript seems to be seriously languishing these days, and the team has falling-outs with a lot of the Wasm ecosystem.
[−] pjmlp 31d ago
Which I actually agree with, as the Wasm ecosystem is trying to be yet another UNCOL outside the browser, bringing CORBA back while pretending it is some great new idea.
[−] afavour 31d ago
Sure. It isn’t TypeScript though.
[−] pjmlp 31d ago
C subset + compiler extensions for some embedded systems isn't proper C, and people still call it C, given how close enough it is.
[−] embedding-shape 31d ago
I'd also steer clear of any language using TypeScript for the compiler itself, even TypeScript themselves don't want to use TypeScript anymore for the compiler, don't make the same mistake yourself.
[−] farmeroy 31d ago
What's differentiates this from something like gleam/lustre?
[−] duesabati 31d ago
I think this project is super interesting and I really like the rust inspiration here. How can one get in touch with you and/or help out the project?
[−] bryanrasmussen 31d ago
I'm not sure I understand the benefit of compiling to both JavaScript and WASM? Since I would normally expect to use both in the same environment, probably I haven't considered something or am overly tired at the moment so asking sincerely.
[−] light_ideas 29d ago
[dead]