Live data from Hacker News

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

news.ycombinator.com

41–50 of 63 posts

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

#41

C# is a good option. F# if you want functional C#. Scala if you are adventurous.

C# is great, if you ignore the lack of algebraic data types and the generally weak type system. Value types in C# are awesome and really make it easy to write super high performance code that doesn't allocate!

F# is awesome if you ignore the fact that it's so easy to shoot yourself in the foot from a performance standpoint with all the lazy constructs. It sure is awesome though to have such a strict type system, though I do sometimes miss features that Typescript has, such as structural typing and mapped types.

In general I do thing the dotnet ecosystem offers a really good set of compromises.

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

#42
post #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. Anywa…

It does, but scalafix helps to avoid some of these issues. I’m not sure how important a very opinionated compiler is to you, but a compiler that does what it can + a good linter isn’t the worst combination.

Once you tap into the Java ecosystem, you can often wrap things into the typelevel ecosystem and work with effects. Generally, Scala with cats/cats-effect is quite pleasant.

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

#44
post #43

In my dayjob I use Haskell + Rust and in many ways I feel like Haskell is a higher level Rust.

Can you elaborate a bit further how you combine both?

We use haskell to design digital circuits using clash[1] and currently using Rust on the driver side. We also have multiple web apps with Haskell backends using rescript in the front end.

[1] https://github.com/clash-lang/clash-compiler

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

#45
Bit left field, but I think Haxe is a good "higher level rust".

* It's garbage collected

* Has algebraic types (enums similar to rust's)

* Pattern matching as good as rust's

* Null check strictness can be configured with the compiler

* Package manager

It's somewhat OOP geared though.

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

#46
Personally, Nim fits a sweet spot for me. It has most of the items you listed, and makes a lot of projects interesting to me much more fun to program. It makes writing CLI utils and quick data migration scripts easy and fun. I use it for embedded software for the great balance of productivity vs performance.

I’ve been working to build more libraries and community for embedded software. It’s been slow going but a couple of companies are using it in shipping products. Nim leverages existing C code very well though.

Though Nim does have its downsides, primarily a smaller community. It’s small but active and not going away anytime soon. I think the ecosystem is slowly building a solid foundation of core libraries since the language reached 1.0 and found its feature set. But it doesn’t have a “killer” feature or single library to drive it. So hopefully the slow and steady buildup can keep going. For example, one big investor in Nim ecosystem for example just hired someone to work full time on the language server / tooling. There’s more work going on with numerical processing too (eg native graphing libraries, etc).

For me in many areas the language more than makes up for the smaller community. I can wrap C/C++ libraries quickly and I don’t need to do borrow checker. Though I would say it sounds like Go or Swift might fit some of your preferences too. Rust is great in many ways but I am more productive with “compile time duck typing” while Rust favors traits and fixed predefined abstractions.

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

#47

Personally, Nim fits a sweet spot for me. It has most of the items you listed, and makes a lot of projects interesting to me much more fun to program. It makes writing CLI utils and quick data migration scripts easy and fun. I use it for embedded software for the great balance of productivity vs performance. I’ve been working to build more libraries and community for embedded software. It’s been slow going but a coup…

P.S. you can see some of the things I’ve been doing as an enthusiast with making a GUI widget system https://github.com/elcritch/fidgetty or esp32 wrapper https://github.com/embeddedNim/nesper/tree/devel

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

#48
post #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.

This is my approach to "higher level rust" - When the borrow-checker and lifetimes start getting too complicated, there's usually an easier but less-optimal fallback. (RC/ARC + mutexes, clones, Strings, Box dyn)

Rust can be a simple(r) language if you're willing to set aside the idea that you need to write performance-critical systems code from day one - just use the basics and optimize if/when needed.

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

#49
post #36

Earlier quoted context omitted.

In many ways Golang is much lower level then Rust. So I wouldn't say it handles this case.

I'm not very familiar with rust, would you be able to share an example?

I’m not the parent poster, but I would assume they are referring to Go’s typical usage of for-loops over something like Streams/Iterators/Comprehensions. (And other cases where idiomatic Go uses the simpler option)

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

#50

I'd recommend going full steam ahead with Rust. Companies like Azure and Meta now recommend Rust as either one of several viable choices, or THE recommended option, for the use cases you describe, including CLI and web servers. Personally at this point, just about anything that's not a frontend (android, ios, web), I think Rust is the best language for the job. It's the language I prefer, and feel most productive in,…

It's crazy how many good GUI libraries there are as well, I've played around migrating some heavier applications and the experience was absolutely painless.
Post reply on HN