3 ms·
> I think that it's possible to build a bridge from Result to panics, thus allowing a developer to choose a particular style of error-handling. I don't understa
by masklinn 6y ago
> I think that it's possible to build a bridge from Result to panics, thus allowing a developer to choose a particular style of error-handling. I don't understand why exceptions are incompatible with language stated goals.
Because they require significant runtime support.
> But that's up to developer to decide, right? By default panics do work. If I want to call `abort()` on panic, I have to explicitly configure it.
Not necessarily. It's the user of a library which decides whether they allow panics or not, so libraries can not assume panics will be available at all.
> Yes, but with improved panics (including hierarchy of panics, capturing stacktrace)
panics already capture stacktraces (if you run with the proper envvar enabled). As to hierarchies of panics… how do you propose to do that in a language without inheritance? Adding inheritance?
> and enhanced language syntax to better integrate that model into a language, rather than discouraging people from using it.
But the language should discourage people from using it. Having multiple ways of doing errors is actively bad, especially when one of them is completely unnecessary and plain doesn't work in many environment.