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?
Just doing types, classes, interfaces again and again isn't really interesting.
Most interesting thing in Rust is not the type system or borrow checker but value semantics.
My recommendation is to create a new language that’s focused exclusively on functions and how to organize them. Organization is an advanced skill learned from experience that is not immediately benefitted from high intelligence and most developers fail in that regard. Think in terms of lexical structures, events, return types, data structures, process flow (technical and business), and call stack.
If you can really dominate concepts of organization by language design the best supporting syntax innovations will shift to more specifically meet your needs.
I'm not so sure about implementation of Rust's semantics in JS. If I want exact Rust semantics, I can use WASM.
However, modern JS-oriented toolchain for ReasonML is called ReScript and you can learn more here: https://rescript-lang.org/
For what it takes, it can inspire you and I find the language very expressive and flexible.
[0] : https://nim-lang.org/
I HATE most js frameworks for this reason. Understanding/Tweaking websites is something I do extensively, and obfuscated minified recursive js makes this REALLY hard.
Another theoretical fantasy that has nothing to do with real world.
In real world we do have null and undefined values. It is artificial and redundant to pretend that there isn’t.
It's aimed at full stack programming, not exclusively backend.
Please stop right here.
Real world is not a theorem.
We, down to earth developers, have had enough of this over engineered crap. We need flexibility.
There is already a near perfect language for JS.
It’s called Typescript.
Youd make a much more good for the world if you improve it, fix few issues etc.