Hello HN,
I'm considering the development of a new programming language, drawing inspiration from Rust's strengths, with a focus on compiling to JavaScript. Here what I'm considering are some key features:
- Strict Typing System: no type-related bugs.
- Algebraic Data Types.
- Exhaustiveness Checks.
- 'Unsafe' Mode: Directly interact with external JavaScript/TypeScript.
- no 'null/undefined': Option/Result instead.
- Trait-Based Programming.
- Backend Development Focus.
- Compiler: dead-code elimination and partial evaluation, similar to Prepack[0] (by Facebook).
I believe this approach could bring significant benefits, especially with recent additions like TypedArray and worker threads.
Would this be of interest to the community? Looking forward to your insights and discussion.
Currently I don't feel confident to complete the project as I am so any recommended resources[1] would be extremely helpful, especially around the area of implementing types.
[0] https://github.com/facebookarchive/prepack
[1] https://github.com/taosx/axido (nothing is decided)
You mention a focus on backend development. Why suffer having to compile to JS if you are not restricted by the runtime environment? (in the backend, surely you can run anything). In my understanding, compiling to JS is only interesting when you want to run in the browser, but outside this constraint, JS seems like a less than ideal compilation target (though probably way better than before thanks to the presence of typed arrays).
Is it interoperability with the JS ecosystem? Wouldn't the no null/undefined criterion be a barrier to this? Or will you take any result from a call to a JS function as optional? Or have interfaces saying "I promise, I will never return null/undefined"?
Or you still want your language to be able to run in browsers? In this case, will you provide a standard library (with the cost of having to transfer it every time it's used), or only a thin wrapper around native JS functions?
You say Rust-inspired. For me, one of the most interesting features of Rust is the explicit management of the lifetime of objects. How do you intend to handle this aspect, with JS not having anything like this?