Hacker News new | ask | show | jobs
by consteval 601 days ago
I mean this is how a lot of exceptions are handled, even in C++. You can use noexcept and whatnot and you don't have to change types and propagate them out. In Rust, you do. Java has maybe the strongest system because not only do you have to declare what can throw but it checks it at compile-time. That's, to me, a full featured effect system.

But errors-as-values are all the rage today. But modifying types, especially every type in the chain, is annoying and overly manual IMO.

1 comments

Yeah, Java had some good ideas but just not quite there on the UX, like many things with Java sigh.

Checked exceptions were annoying because you had to manually annotate the exceptions all the way up your chain. The list of effects should be generated by the compiler, and the IDE should show them when desired. Maybe manually annotated at external API boundaries which double as forcing the API dev to handle unlisted exceptions.