this post was submitted on 01 Aug 2025
148 points (96.8% liked)
Programmer Humor
25425 readers
1034 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I prefer it over alternatives:
The crash early, crash often approach of Erlang has made for some amazingly resilient systems.
One time on a project I was working on, some horribly broken code was merged (nobody in the team had even heard of reviewing code). As soon as a specific call was made, it was executed once and then the thread crashed. The only way we noticed was that response times increased with load. All data and behavior was still correct. Whole nodes could go down and all you notice is a dip in performance until it comes back online.
Of course it requires special care in designing. Everything runs in stateless server threads with supervisors restarting them as needed. This in turn requires some language support, like lightweight threads. Our application would happily run tens of thousands of threads on an ancient sparkstation.
It is a nicer way I think. But other languages do allow for good exception handling. It's just there's not a clear cut sign that no-one has handled the exception yet. So often it doesn't get handled.
What I mean by that is. If I have a function that returns say a string. As a caller, you don't know whether that function is always going to return a string (it handled exceptions internally), or if it returns a string but might return an exception. So you need to try/catch (or whatever is the equivalent in that language). It's not clear to the caller.
Whereas with rust, if you're holding a value wrapped in a result, it means that any exception hasn't been handled yet. If you're not passing the value (still inside the result) back to a caller, tag you're it! :P
I like the flexibility Rust offers with the result type. It makes the error handling part of the control flow rather than an afterthought.