Tangentially related: has anyone been exploring ReasonML? I am enjoying it so far, but still hesitant because I'm not sure if its momentum (in the community with packages, etc) will sustain, and the interop into JS feels still somewhat clunky (though that is partly BuckleScript)
I have, and really enjoy it. My previous go-to for frontend was TypeScript, but it wore me down. I am ridiculously productive in ReasonML with proper ADTs, (exhaustive!) pattern matching, immutability and other niceties. The superb type inference is also great for prototyping, and I could go on and on. Rust for backend and ReasonML for frontend is making me very happy these days. I think the community will only keep growing. I feel like I’m an extra in the filming of Revenge Of The MLs, and it feels great.
> My previous go-to for frontend was TypeScript, but it wore me down
Yes, coming from Scala.js it feels like TypeScript constantly tells me little lies (i.e. that the runtime type of the typed type is not in fact the type in question, but something else entirely). A powerful language with plenty of interesting features, but there are better options out there if strict typing is of interest.
No choice in current project, Angular essentially requires TypeScript. Editor support for TypeScript (via VS Code) and JS interop are, however, excellent.
Sure. I would say that Rust and ReasonML are very alike and very different at the same time, and I'll explain why I feel that. ReasonML's own docs give Rust a notable mention: "Close cousin of ours! Not garbage collected, focused on speed & safety."
They both
- have powerful static type systems with good inference.
- default to immutability, with optional mutability.
- encourage functional constructs over procedural/imperative ones.
- ADTs and exhaustive pattern matching with great ergonomics which can be used for everything from rigorous error management to unambiguous program state representation.
- have escape hatches to write "I know what I'm doing and need more wiggle room"-code, but those are clearly visible for linting/auditing/testing, as opposed to languages that allow foot guns to invisibly permeate entire code bases because the language has no clearly discernible rigorous subset that one easily and naturally can keep to.
The list of features that make them alike can be made as long as your arm, and it's basically a laundry list of features that (once internalized in the developers mind) helps one build robust, correct, maintainable software. Sure, they're not carbon copies of each other but what it comes down to is enabling and encouraging the same semantic constructs.
So where are they not alike? I would say that the one constraint that the main differences result from is the fact that ReasonML's automatic memory management is a run-time solution (garbage collection) whereas Rusts is a compile-time solution (using static analysis), coupled with Rusts focus on raw performance. Everything else about the Rust language has (IMHO) been designed with the same sound underlying values as many other languages which encourage correctness. The differences that one notes when learning Rust are really mainly just the concessions that were necessary to make to achieve compile-time automatic memory management and raw performance.
Did that help? And as always, if I'm mistaken about anything, please correct me. I'm not a PLT person.
Absolutely. I've been a Rust lurker (and later user/advocate) since ~2012/2013, I think, and the visible WASM support strides being taken right now coupled with my trust in the Rust community gives me great hope for Rust on the front end.
It remains to be seen to what extent and which problems it will be suitable for, but just as Rust despite the fears of some is (again, IMHO) turning out to be ergonomic enough to write all kinds of end user apps in (although some areas are still lacking, but give it time), so too I think it might surprise people with how widely applicable it may turn out to be on the front end.
And I'm hopeful and optimistic. I feel like we're seeing some tides turn with respect to how important software correctness/robustness really is perceived to be and -- importantly -- what we're prepared to pay for it. We're still a "young" industry compared to a lot of engineering disciplines, so it's not surprising that we're still maturing with periodic waves of change. Of course, many will disagree with the direction, but for me it can't come fast enough.
Sorry, I hadn't ranted in a while, and it is Friday afternoon. =o)
So far I've been using Python/JS/TypeScript mostly and I'm striving for a better Type System and more functional capabilities. ReasonML offers a lot of the things I was looking for:
* Familiar syntax (coming from Python/Go/JS/TS etc.)
* A lot of functional capabilities.
* A nice flexible type system.
* High (predictable) performance.
* Fast compile times.
* Compiles to byte/native/JS
* A mature compiler.
I'm still having an eye on three things:
1) What's the concurrency model going to be.
2) What's the solution for unicode going to be.
3) At what pace is the ecosystem going to grow.
If things turn out well, I can imagine OCaml/ReasonML becoming my general purpose language of choice for most of the stuff I'm currently using Python/Go/JS/TS for.
I recently started with a frontend using bucklescript-tea [0] and it's a great experience so far!