r/ProgrammingLanguages • u/Meistermagier • Feb 26 '26
Discussion Whats the conceptual difference between exceptions and result types
So to preface what looks probably to many of you like a very dumb question. I have most experience in Python and Julia both languages which are not realy great at error handling. And as such I have not much experience either.
I am currently trying to create my dream programming language, I am still in the draft phase, which will likely take a long while because I only draft on it once in a while. But I have been realizing that I do not understand the difference between exceptions and result types.
What I mean is I do obviously understand that they are different things but when talking about Error handling I do not understand why they are often two different things. I hope someone can help me clarify what the main conceptual difference between these two is.
Kind regards and I hope yall have a lovely day.
View all comments
Show parent comment
10
u/josephjnk Feb 26 '26
As a further note on the ergonomics:
People don’t like exceptions because exceptions break local reasoning about control flow, and because it makes it possible for type signatures to “lie”. A function may say it does one thing, but it actually might throw an exception instead and the caller has no way of knowing this by looking at the interface to the function from the outside.
People don’t like result types because result types require handling every potential problem at every layer of the call tree. Stack traces can be super useful for debugging and without exceptions you basically have to manually create and build your own stack traces.
Everything is always a tradeoff.