frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

High-Level Rust: Getting 80% of the Benefits with 20% of the Pain

https://hamy.xyz/blog/2026-01_high-level-rust
33•maxloh•9h ago

Comments

fyrn_•3h ago
Based on your description, I think a good library for data structures that are intended to be used immutably would help with some pain points. Something with copy on write support or something like that. It's a powerful style, used it in haskell and it prevents a large class of bugs, almost down to just business logic bugs, which is what you want.

I like the style you're describing, thanks for sharing.

moomin•2h ago
C# has indeed finally gained sum types this year… in preview. We’ll see if anything makes it into C#15 but they’re closer than they’ve ever been.
zigzag312•1h ago
Type unions only at first, but there's more being planned.
vibbix•1h ago
Java have less of a DevEx score than C# is crazy work.
ysleepy•1h ago
I agree that the rust community frowns a little too much on the use of Arc/Cloning/Box. If you use swift, everything is ref counted, why subject yourself to so much pain for marginal gain.

Tutorials and books should be more open about that, instead of pushing complex lifetime hacks etc., also show the safe and easy ways.

The article gives Java a worse devx rank than Go and I can't agree. Java is at least on par with go in every aspect of devx, and better in IDE support, expressiveness, and dependency mgmt.

fyrn_•1h ago
Pretty sure by devx they mean something like syntax ergonomics. Because otherwise rust's devx first class (cargo, clippy, crates.io) so kind of a nonstandard definition.

I think it's fair to say Java's "syntax ergonomics" are a little below the rest / somewhat manual like rust or C++ by default.

ysleepy•28m ago
Yeah, but worse than Go?
VorpalWay•1h ago
> I agree that the rust community frowns a little too much on the use of Arc/Cloning/Box

As usual, this depends heavily on what you do. I had written a program where Arc reference counting was 25 % of the runtime. All from a single instance as well. I refactored to use borrows and annotated relevant structs with lifetimes. This also enabled additional optimisation where I could also avoid some copies, and in total I saved around 36% of the total runtime compared to before.

The reason Arc was so expensive here is likely that the reference count was contended, so the cacheline was bouncing back and forth between the cores that ran the threads in the threadpool working on the task.

In conclusion, neither extreme is correct. Often Arc is fine, sometimes it really isn't. And the only way to know is to profile. Always profile, humans are terrible at predicting performance.

(And to quite a few people, coming up with ways to avoid Arc/clone/Box, etc can be fun, so there is that too. If you don't enjoy that, then don't participate in that hobby.)

indigo945•51s ago
For the use cases outlined in the OP, a 36% performance gain for an optimization that complex would be considered a waste of time. OP was explicitly not talking about code that cares about the performance of its hot path that much. Most applications spent 90% of their runtime waiting for IO anyway, so optimizations of this scale don't do anything.
dev_l1x_be•50m ago
I am not sure the community frowns on these. In fact I use those in almost every Rust code I write. The point is that i can grep for those because Rust does not do it in a hidden way.
fork-bomber•1h ago
Crystal lang deserves a look given the article writer’s preferred language attributes. It has OO paradigms, elegant composability, efficient codegen etc.
hackingonempty•1h ago
F# but not Scala? In TFA F# is only lacking in community and ecosystem. Scala is comparable in popularity to Go or Rust and has access to the entire Java ecosystem and JVM runtime. That should give it the five stars the author is looking for but its not considered.

I think a lot of devs are missing out by not considering Scala 3. I use it with the Zio effect system which brings composable concurrency and transactional memory amongst other features. I don't think there is anything comparable in any of the languages listed in TFA.

usrnm•38m ago
> Scala is comparable in popularity to Go or Rust

Do you have any numbers to back you up? That statement sounds very, very wrong to me

jurschreuder•1h ago
I program almost all languages except C# and Rust haha.

So someone looking for the perfect languages while actively using the only two languages I actively avoid is very strange to me.

C# has close to zero community and only really works properly in Windows which is far past its glory days. Except for Microsoft aggressively pushing it as a Java alternative it has no right to exist.

Rust is an overcomplicated subset of C++ that solved memory problems the most recent versions of C++ don't have anymore, and only survives by aggressive marketing, full of grouping things together that don't belong together, like C/C++. And memory safety / use-after-free.

If C and C++ are basically the same because they have access to manual memory allocation then Rust/PHP are also basically the same.

And Rust's borrow checker only solves use-after-free which statistically are 10% of memory related vulnerabilities. Not "memory safety" of which 60-70% is just array out of bounds.

Really the worst two languages that both only survive in aggressive marketing.

dannersy•59m ago
You do not write Rust yet will make blanket absurd claims about Rust being overcomplicated or not solving your problems. The additional comparison of Rust to PHP is also ridiculous for so many reasons it might not be worth even discussing, because it just seems bad faith from the start.

You're missing a very fundamental point here, and this is usually something I find with long time C programmers. C is a great, but old language, with decades of overhead on context, tooling, and lib understanding that make getting in to writing C substantially more difficult than say, Rust. We are still humans, and Rust isn't entirely trying to solve C from a fundamental paradigm of handling memory from a technical point of view, but more from a programmer one. Your comment about solving memory bugs is predicated on perfect human usage of C to not write the bug in the first place, which is precisely one of the many problems Rust is looking to solve.

PhilippGille•7m ago
> C# [...] only really works properly in Windows

What do you mean with this? Maybe you are thinking of the old ".NET Framework" runtime, which only runs on Windows? Nowadays there is ".NET Core" which runs on macOS and Linux as well.

dannersy•1h ago
Is this another AI article? What is said about Rust here has been said over and over again, and this brings nothing new to the table. They also always seem to be writing from a place of ignorance. If you're writing "high level Rust" the use of clone or Arc or whatever is negligible. If you're writing an HTTP service, your clone will be so fast it will make literally zero difference in the scope of your IO bound service.

Another observation is developer experience. Again, have you written _any_ Rust? I would argue that the reason Rust is such a joy to use is that the compile time errors are amazing, the way docs are handled are amazing, and so on. I know the eco system for something like Typescript is worlds better, but have you ever tried to _really_ understand what shenanigans are going on behind the scenes on some random hook from say, React? Their docs are so dismal and sparse and make assumptions on what they think you should know. Rust? You go to the doc gen, read what they think you should know as an overview, and if it isn't enough, I can click on "source" to dive deeper. What more could I possibly want?

Perhaps I'm just triggered. The discussion on Rust always seems to be fad or hype driven and almost always have very little to do with how it is to actually use it. If I have to read about compile times, again, I'm going to scream. Of all the languages I've used, it is one of the best in terms of a mature project needing new features or refactors. This is mentioned in some articles, but mostly we hear about "velocity" from some one dimensional perspective, usually someone from the web space, where it is arguable if the person should even bother trying to use Rust in the first place.

Apologies for the rant, but at this point I think Rust as a buzz word for article engagement has become tiring because it seems clear to me that these people aren't _actually_ interested in Rust at all. Who gives a shit what someone on Reddit thinks of your use of clone??

throwawayqqq11•11m ago
What triggered me was the proposed Arc<dyn TRAIT> as a quick fix. I was highlevel rustin along the learning curve as the article describes until i stumbled uppon dyn-compatible types and object safety.

It is too easy to trap yourself in by sprinkling in Sized and derive(Hash) ontop of your neat little type hierarchy and then realize, that this tight abstraction is tainted and you cant use dyn anymore. As a follow up trigger: This was when i learned derive macros :)

slopinthebag•45m ago
No code examples? Wtf?

If you want to see high level rust, check out Dioxus. It's a web framework, and it's extremely React-like both in architecture but also ergonomics. I actually had AI migrate a JS project to Dioxus and I think it was something like 75% of the code. Pretty decent for a "low level" language.

Tade0•42m ago
Regarding TypeScript:

> but types lie at runtime (unsound) requiring you to add your own runtime checks.

I don't recall doing that outside of situations when data is crossing system boundaries.

The vast majority of languages have an unsound type system, yet people are productive in them.

Over the years I've come to realise it's a form of nitpicking. You absolutely need it in some applications, but it's not an important requirement most of the time and it's given undue importance by some.

teaearlgraycold•1m ago
The main problem with TypeScript is the default compiler flags are not safe. I understand having things weak when you’re getting the ecosystem up and running, before you have wide adoption. You don’t want to throw too many red squigglies at early adopters and cause them to give up. But these days the default should not allow any. No implicit any. No explicit any. The stdlib should not use it. JSON.parse() should return either unknown or a recursive union that defines all valid JSON structures.

I believe it’s largely because of these defaults that the idea that TypeScript isn’t really checking types persists. Without the any type, or loose undefined and null checks, your types are as validated as they can be. The only failure point is deserialization or an import which doesn’t type check. And deserialization has this problem in every language.

When you compile C to machine code the executed binary isn’t checking types. This is no different from Typescript that’s been compiled to JavaScript.

pjmlp•36m ago
It is called OCaml.
gertlabs•36m ago
Since programming is increasingly offloaded to LLMs and English is the main way engineers interact with code, it's interesting to see how LLMs reason in different programming languages.

In our benchmarking, we've found LLMs perform comparably between languages for one-shot coding submissions, slightly favoring more popular languages. But if you give frontier LLMs a harness and let them iterate / fix compilation errors, they actually significantly outperform in Rust. Meaning, they come up with more insightful ideas when developing Rust, than for example Javascript.

Scroll down to the language comparison chart: https://gertlabs.com/?agentic=agentic

nananana9•35m ago
Most of the Rust code I've read is arc-mutex-slop.

What this optimizes for is not actually having to deal with the pain in the ass that proper Rust is, but still allowing you to be in the cool kids club writing "blazingly fast software", all while writing what's pretty much Java or C#, but with a terrible non-functional garbage collector instead of a state of the art one.

ai_slop_hater•32m ago
> Most of the Rust code I've read is arc-mutex-slop.

Skill issue

jackjeff•34m ago
Isn’t this “high level rust” idea similar to swift?

Everything is ARC. Clones are cheap. But you still have a reasonable sound type system and no garbage collection.

I get it. Tooling on swift is meh the further you are from Apple, so I’m not suggesting it’s better.

But from a language point of view; is it not essentially a high level rust?

Ps. I don’t really know swift. Just asking where/why I’m wrong really.

bluegatty•21m ago
It's not ARC though. They use fancy threading mechanisms to avoid having to check on every access. Much faster.
ai_slop_hater•31m ago
It is absolutely bizarre to not check DevX for Rust, it was literally the most loved programming language for years according to SO surveys.
Imustaskforhelp•29m ago
When someone mentions High-level rust, gleam comes to my mind. Although the language is functional and not OOP, but at-least from the perspective of type-system its well written and it can also hook into the elixir/erlang ecosystem.
bluegatty•22m ago
Java is a fine language and has sufficiently expressive types. It's the most consistently overlooked language and frankly it's completely annoying. Java is a powerhouse. If you can live with a VM, it's an amazing language. The disdain for Java is honestly just weird. The boiler plate is only marginally annoying to write and makes it considerably easier to read. The 'enterprise ecosystem' is definitely bloat, but that's not Java.
loglog•16m ago
1. Java is mentioned in their comparison table. They just don't use it much. 2. There is really no reason to include Java in the search for your preferred language, since Kotlin is strictly better along every relevant axis.
bluegatty•11m ago
Kotlin is a few tweaks on top of Java, most of which aren't relevant anymore, and it's not strictly better in most ways other than saving a few keystrokes (and preference).

It's a little bit nicer to write but that's almost irrelevant.

It also comes with some runtime cruft.

In reality there is no Kotlin without Java, which means most projects end up a bit 'dual'; every single Kotlin project we've had (except Android) folded back onto Java. Even Scala wasn't worth it, though that's a different question.

Small models also found the vulnerabilities that Mythos found

https://aisle.com/blog/ai-cybersecurity-after-mythos-the-jagged-frontier
1058•dominicq•15h ago•290 comments

I run multiple $10K MRR companies on a $20/month tech stack

https://stevehanov.ca/blog/how-i-run-multiple-10k-mrr-companies-on-a-20month-tech-stack
112•tradertef•2h ago•66 comments

Tofolli gates are all you need

https://www.johndcook.com/blog/2026/04/06/tofolli-gates/
34•ibobev•4d ago•6 comments

The End of Eleventy

https://brennan.day/the-end-of-eleventy/
149•ValentineC•6h ago•107 comments

US appeals court declares 158-year-old home distilling ban unconstitutional

https://www.theguardian.com/law/2026/apr/11/appeals-court-ruling-home-distilling-ban-unconstituti...
121•Jimmc414•3h ago•83 comments

How We Broke Top AI Agent Benchmarks: And What Comes Next

https://rdi.berkeley.edu/blog/trustworthy-benchmarks-cont/
363•Anon84•13h ago•93 comments

How Complex is my Code?

https://philodev.one/posts/2026-04-code-complexity/
111•speckx•4d ago•24 comments

Simplest Hash Functions

https://purplesyringa.moe/blog/simplest-hash-functions/
39•ibobev•4d ago•32 comments

Dark Castle

https://darkcastle.co.uk/
178•evo_9•12h ago•23 comments

447 TB/cm² at zero retention energy – atomic-scale memory on fluorographane

https://zenodo.org/records/19513269
208•iliatoli•12h ago•101 comments

Pijul a FOSS distributed version control system

https://pijul.org/
140•kouosi•4d ago•23 comments

Apple Silicon and Virtual Machines: Beating the 2 VM Limit (2023)

https://khronokernel.com/macos/2023/08/08/AS-VM.html
197•krackers•11h ago•134 comments

How a dancer with ALS used brainwaves to perform live

https://www.electronicspecifier.com/products/sensors/how-a-dancer-with-als-used-brainwaves-to-per...
38•1659447091•6h ago•8 comments

Advanced Mac Substitute is an API-level reimplementation of 1980s-era Mac OS

https://www.v68k.org/advanced-mac-substitute/
238•zdw•16h ago•61 comments

Cirrus Labs to join OpenAI

https://cirruslabs.org/
263•seekdeep•19h ago•126 comments

Surelock: Deadlock-Free Mutexes for Rust

https://notes.brooklynzelenka.com/Blog/Surelock
209•codetheweb•3d ago•67 comments

Show HN: Pardonned.com – A searchable database of US Pardons

424•vidluther•1d ago•238 comments

How to build a `Git diff` driver

https://www.jvt.me/posts/2026/04/11/how-git-diff-driver/
111•zdw•14h ago•12 comments

Anthropic silently downgraded cache TTL from 1h → 5M on March 6th

https://github.com/anthropics/claude-code/issues/46829
12•lsdmtme•2h ago•2 comments

Why meaningful days look like nothing while you are living them

https://pilgrima.ge/p/the-grand-line
33•momentmaker•5h ago•20 comments

The Soul of an Old Machine

https://skalski.dev/the-soul-of-an-old-machine/
52•mskalski•4d ago•11 comments

Software Preservation Group: C++ History Collection

https://softwarepreservation.computerhistory.org/c_plus_plus/
23•quuxplusone•7h ago•2 comments

What is a property?

https://alperenkeles.com/posts/what-is-a-property/
72•alpaylan•4d ago•20 comments

Network Flow Algorithms

https://www.networkflowalgs.com/
5•teleforce•5d ago•0 comments

High-Level Rust: Getting 80% of the Benefits with 20% of the Pain

https://hamy.xyz/blog/2026-01_high-level-rust
33•maxloh•9h ago•32 comments

Optimal Strategy for Connect 4

https://2swap.github.io/WeakC4/explanation/
289•marvinborner•3d ago•31 comments

Every plane you see in the sky – you can now follow it from the cockpit in 3D

https://flight-viz.com/cockpit.html?lat=40.64&lon=-73.78&alt=3000&hdg=220&spd=130&cs=DAL123
321•coolwulf•3d ago•59 comments

The APL programming language source code (2012)

https://computerhistory.org/blog/the-apl-programming-language-source-code/
68•tosh•15h ago•22 comments

The Problem That Built an Industry

https://ajitem.com/blog/iron-core-part-1-the-problem-that-built-an-industry/
126•ShaggyHotDog•18h ago•44 comments

New synthesis of astronomical measurements shows Hubble tension is real

https://noirlab.edu/public/news/noirlab2611/?nocache=true&lang=en
59•anigbrowl•13h ago•13 comments