Live data from Hacker News

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

news.ycombinator.com

11–20 of 63 posts

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

#11
post #7
post #2

Golang is continuing to grow to serve this use case. Just like explicitly handling errors though- you'd be expected to explicitly handle null values if you want to be safe from them

I like the idea of Go, except I don't think it quite has the type system that I like. I saw it got generics recently, but that actually wasn't very high on my priorities, compared to being able to say "this value is an integer and definitely not nil", OR, saying "this value is an integer OR it could be nil, and I want the compiler to make sure I'm considering the nil case." And I appreciate that it has the "errors as…

IIRC, you can't have a nil value, just a nil pointer. I like that because it makes you avoid using nil/null/none as a magic value as a habit (not completely, because yeah, pointers).

But it's definitely no Rust. It's a very small language by comparison. That's a positive for me, but you can't have all the Rust things and that at the same time.

I'm not a "1 language for everything" guy. I tend to choose for the task if given the choice or choose for the team so I'm not stuck being the only one that can maintain it. And for anything more than a toy for myself, I always pick something mainstream.

If I'm slapping something together as a 1-off, I tend to go with Python. If I'm writing a CLI, I tend to use Go and I'm using it more for backend stuff. I'll use Java if I have to, because of the team thing. But I won't like it. For toy stuff, I'll pick a language out of a hat just to learn something new. Every few years I'll use a LISP/Scheme.

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

#12
Scala

* Getting nullability right - Tick.

* "Algebraic" (Sum and Product) data types. Tick.

* Errors as values - Tick.

* Focus on the data - Tick.

* A nice development experience - Tick (has got a lot better in recent years).

* Vibrant and growing community - Tick. Hard to know if it's growing, but it feels like it has a very stable niche imho. I see a lot of dynamism in the communities I follow like Typelevel.

* Can develop comfortably on Mac, deploy to Linux. Windows support a "nice to have. Tick. I've developed on all of these environments.

Is it a "higher level Rust?". It's a very different beast but, based on your checklist at least, it fits the items them than most other mainstream languages imho.

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

#16
post #12

Scala * Getting nullability right - Tick. * "Algebraic" (Sum and Product) data types. Tick. * Errors as values - Tick. * Focus on the data - Tick. * A nice development experience - Tick (has got a lot better in recent years). * Vibrant and growing community - Tick. Hard to know if it's growing, but it feels like it has a very stable niche imho. I see a lot of dynamism in the communities I follow like Typelevel. * Can…

Doesn't scala inherit type erasure from Java / the JVM though? That means nullability and sum and product types can never be sound in it, and every line can throw some unexpected exception (just like Java), right?

On top of that, the classloader makes an open world assumption, at least with the JVM, so the compiler can never prove me wrong on any of the above points, regardless of what program it's been handed.

Anyway, I've been there and done that with Java, and I'm hoping to never put up with that ecosystem again. I'd much rather fight the borrow checker than deal with null pointer and class cast exceptions in production.

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

#18
IMHO swift has one of the most beautiful type systems and is more high level than rust. Of course youre limited on what platforms you can use it with but server side swift is getting a lot more attention. Kotlin is pretty comparable though so maybe that’s your best bet. Haskell is also great but if you want the slightly more imperative style then I think kotlin or swift are the best fits. I find all to be the times I have the most fun programming. You can also get part of the way there with typescript and the fp-Ts ecosystem but of course the type system has a lot less overlap with rust

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

#19

C#/F# being Windows languages is plain false; they have been cross-platform FOSS for just under a decade. TypeScript has a good number of features you're talking about, but I still wouldn't use it myself, because it is only a static checker on top of a much worse underlying system, and the static checker has plenty of holes big enough to fit serious problems through. Your best option as far as I can tell is Swift. It…

I tried to write a little Linux utility that would walk the filesystem in C# a while back.

It convinced me the language doesn't really support Posix systems after all.

(Obviously, Linux software that's been written in C# exists; maybe I was using the wrong standard library or something. I went with whatever Microsoft's documentation suggested.)

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

#20
Have you tried wrapping everything in an Rc (or Arc>) and keeping everything synchronous and single threaded? I've seen people report good success with that for low-performance stuff.

Reference counted languages provide 99% of the benefit of full GCs for simple programs, and I think those two suggestions are enough to mindlessly appease the borrow checker in most circumstances.

Post reply on HN