Discussion

Ask HN: What's the best “higher level Rust” these days?

After playing with rust, I really like it. However, I generally don't need to write the low level code that justifies the increased complexity of the borrow checker. I would rather just pay the small price for a garbage collector. What language is most like rust, but at a higher level?

To me, these are the things that I like about rust that I'd want to see:

* Getting nullability right, not making the "billion dollar mistake". An integer shouldn't be able to be "null" unless it's part of the type.

* "Algebraic" (Sum and Product) data types. I love Typescript's "integer | null" syntax, but Option<int> or something like that is fine, too. Typed structs/records or tuples.

* Errors as values. Goes naturally with the ADTs, and it feels very robust having the compiler enforce handling all the "Ok(..) | Err(..)" results.

* Focus on the data, defining structs and functions that work with structs. "Traits" as a means of abstraction. Not much in the way of inheritance.

* A nice development experience with a good package manager or other way of finding and using open source code.

* Vibrant and growing community.

* Can develop comfortably on Mac, deploy to Linux. Windows support a "nice to have".

Rust just nails all these things so well, it makes me want to use it even for things that don't seem like a good fit to me, like command line tools or web servers or scripts.

Here are the languages I can think of that might work, but I think they all have some issues:

* Ocaml - Rust's heritage, so it makes sense. But I feel like it's been around forever and hasn't really taken off. And doesn't it still have some sort of concurrency issue?

* Swift - So close to the ideal language, but does it work well outside of the Mac ecosystem?

* F# - Conversely, another great language, but does it work well outside of Windows?

* Java - The last time I used Java in earnest (many, many years ago) it still had the nullability issue, and was too class/inheritance focused for my tastes. I'm not sure if modern Java has improved on this yet.

* Typescript - Is this it? As a language, it actually ticks all the boxes, I think, which surprises me. But as a runtime it's nonexistent, and so you have to compile to Javascript and run on node and all that. I use it and really like it on the frontend. But how is it on the backend for ordinary non-web applications? How's its performance? It feels fiddly to get all the build stuff running, but maybe Deno or Bun is an option here.

* Nim - Kind of off the wall here, but it looks like it might actually be a contender from perusing its docs. But its community is pretty niche, and I don't have a good sense on if its growing or not.

61 points losvedir 4 years ago 61 comments

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton