Live data from Hacker News

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

news.ycombinator.com

21–30 of 63 posts

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

#21
post #9

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

Oh, of course Haskell should be on the list, at least from the language/types perspective! What about packages? Last I looked into Haskell (years ago), there was some light controversy over two competing package ecosystems, I think. Has that settled down?

There's never been competing ecosystems. There is and has been one package manager: cabal.

You are probably referring to stack, which is a just wrapper around cabal that makes some decisions for you. For instance, it pins a set of packages to known-to-work-together versions. It also provides a different CLI (cabal's is a bit verbose).

Today, cabal has improved quite a bit (Nix-style builds, for instance), so the pain stack was invented to help with isn't really there anymore. If you invented stack today, it probably wouldn't get the same level of adoption.

But there are plenty of good packages out there. There often are many different packages for the same thing with different approaches (best part of Haskell!), but for core infrastructure the ecosystem tends to settle and rally around one.

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

#22
post #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.)

Yeah, this is mistaken. At my last job we deployed tons of c# on Linux. The .net ecosystem is a little complicated because of the slow convergence of its std library and runtime (.net core, .net standard, .net framework, .net), but as of a few years ago a bog-standard .net app did everything you’d expect on any computer.

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

#23
F# is not a windows language. It's been open source from the start and there are many compiler implementations that does not depend on Windows at all, like Fable.

That said I think it has many parallels with Rust and I enjoyed reading this comparison between the two https://github.com/Dhghomon/rust-fsharp

It shows how strikingly similar the two languages are, at least on the surface.

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

#24
Unfortunately I have to agree with your inner voice that there's no perfect language out there.

I'm building my first library in OCaml for a number of great reasons: 1. the type system we all want 2. multicore is here (but in RC) 3. algebraic effects is here (but in basically RC) 4. build system is pretty good after you warm yourself up a bit. i ran into some weird dep issues recently but overcame it by vendoring deps directly.

A hard requirement for me is to be able to generate native executables, and only OCaml / Rust / Swift has this with a more modern type system. If I wasn't so focused on learning in an fp language, I'd use Rust for my needs.

If you asked for a vote, I'd say give 2 weeks for each of your top 3 languages. Opinions and anecdotal experience will always be beaten by personal experience.

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

#25
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, for the use cases you're describing (web server, CLI, small scripts and utils).

There's a learning curve, but at this point, I almost entirely forget about the lack of GC. It feels like writing code in any other language - except of course with all the benefits you call out (no null, ADT, typed error values, trait-based OO system, the best tooling of any language I've used, expansive 3rd party libraries).

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

#27

I’m not sure that any language meets these criteria yet, but I’m placing my bets on Swift. There’s been a lot of activity in Swift’s various cross-platform working groups recently… whether or not that pans out remains to be seen, but within the community there’s absolutely a desire/will for Swift’s cross platform story to improve. Personally speaking, if Swift’s Windows/Linux support improved and a cross platform UI…

Sadly I think swift has missed the boat. Rust has eclipsed it in terms of cross platform and widely use crates. Swift was never big into the cross platform scene and now I think it's missed the boat.

Furthermore swift's lack of macros means you're at apple's behest to have important changes to the language made. Rust didn't come up with serde, arguably one of Rust's "killer apps"; it's a third party package that the language merely makes possible. But in swift, such a thing would be impossible to do at compile time without explicit support from apple. This means that language can only provide functionality blessed by apple.

Swift is a neat language but it's got a huge uphill battle if it wants to become widespread and I just don't see it happening when all it offers over rust is that you don't have to worry about lifetimes.

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

#28
Nice thread. The comment about "full steam ahead with Rust" was nice.

Like you I've been on a basically identical search, but instead of coming up from Rust I've come down from dynamically typed languages on the backend. I just couldn't bear another run-time error that would have been easily prevented with Typescript.

I've come to the conclusion that the palette of ergonomic and statically typed languages for the backend is surprisingly quite sparse (when one includes the requirement of a relatively sizable community) if you don't include Java/Go.

Languages I personally crossed off:

* Java - Just much too verbose for my taste, too mutable, too nullable, and I don't find "Kingdom of Nouns" elegant to program in. (The JVM is quite magnificent though..)

* Golang - I get why people like it, and I have absolutely nothing against it. For me it's not expressive enough.

* Typescript - Pretty much 100% what you said. The language itself is wonderful, but it really shines when confined to the browser. The runtime differences between the Browser/Node cause all sorts of problems. Also compiled binaries are nice, which are out here.

I see why somebody might choose each of those languages, and be highly justified in doing so, but for me they didn't fit the bill.

That leaves:

* Scala - Only have very light experience. Really strong support for functional/immutable style programming, and checks all the boxes as another commenter pointed out. Community seems a bit complex at times. I haven't had time to really dive into it, but it's been on my mind.

* Rust - Seems like it nails a lot of things really well. Haven't ever touched it, so I can't give an educated appraisal of its merits. The only real obvious con is that it's "overkill" for systems dealing primarily with business logic, i.e. where GC isn't a big issue.

* Swift - Seems quite excellent, but I had written it off as unsuitable for general purpose stuff. Perhaps a premature take?

* Nim - The one on the list I have played around with the most. Seems to have a very powerful macro system which I have yet to take full advantage of. Feels like a statically-typed python, with a bent towards an imperative style over a more functional one. I am personally thrilled they went with the decision to make "func" a fist-class keyword, with special compiler significance. Still a bit niche however.

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

#29

Nice thread. The comment about "full steam ahead with Rust" was nice. Like you I've been on a basically identical search, but instead of coming up from Rust I've come down from dynamically typed languages on the backend. I just couldn't bear another run-time error that would have been easily prevented with Typescript. I've come to the conclusion that the palette of ergonomic and statically typed languages for the bac…

You should check out Kotlin if you like Swift (but think it's not general purpose enough) and the JVM!

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

#30
I learned F# before I took a dive at rust, while I don't have use cases for rust on my day to day I think these two languages are very similar and you can fare a very long way with what you already know from rust it is worth taking a look at it

F# is cross-platform with excellent tooling from vscode via ionide extension, jetbrains rider, and visual studio, it also ticks several boxes from above :)

Feel free to chime in twitter there's the #fsharp hashtag, The F# Org slack https://fsharp.org/guides/slack/ and the unnoficial F# discord server https://discord.com/servers/fsharp-196693847965696000

Post reply on HN