Conversation
Notices
-
Embed this notice
there's a special place in hell for people who catch exceptions and, in the exception handler, raise a new exception that says "an error happened"
-
Embed this notice
@s8n i think the theory is you have to either resolve the exception locally or make "this could throw" part of the function signature. so if a function says it throws nothing you can be certain that it will never result in a non-local jump past the caller.
i don't think this has resulted in anything useful ever, though. i've been fiddling with viper and why3 lately and i have a feeling these kind of semantics are better done as annotations and outsourced to checkers that will actually do good jobs instead.
-
Embed this notice
@icedquinn you could just let the exception bubble up I don't understand how this even began
like if the participants in this alleged java stupidity were arguing with each other from first principles how could they ever justify forcing every single person who might possibly raise a checked exception to handle it? The exception already fucking has all the information in it you need. Just fucking show it, put it in a log file or something. Like holy fucking shit why should someone have to reinterpret it?
try {
//to connect to a fucking sequel server
} catch {SQLException e) {
//give the fuck up I guess? You can't fucking recover from this without the user
throw new RetardedNiggerException("I am deleting the error message and raising a useless one because I'm a fuckin midnight porch cricket lol go fuck yourself");
return;
}
-
Embed this notice
@s8n nim's effect tracking works similar but its more that you tag functions with something like "IO" and you can declare a function may only inherit some specific tags. which means a function can be tagged with "nothing" allowed and calling an IO function there will get you hit with a newspaper. its a neat and cheap mechanism nobody actually uses.
araq has been trying to push for non-recoverable errors ("defects") which is very annoying to me. you still get defensive tests for range etc, and they throw, but they throw "super special can't catch this" errors, so your system still fucking goes down like rust :blobcatangry:
ada is at least honest enough to be like "nah, we live with these. might as well let 'its out of range YOU FOOL' be a recoverable condition."
-
Embed this notice
@s8n i think java created this. the whole "you must enumerate your checked exceptions" turned out to be cancer.
ada seems to be one of the only langs that handles exceptions correctly :comfyglare:
-
Embed this notice
@s8n safety by construction is real its just the ada devs do that while sun was kind of goobered about a lot of shit they did.
-
Embed this notice
@icedquinn it has to be some kind of hubris caused by inexperience. They probably figured software development could solve any problem in a higher-dimensional space by just adding abstraction layers until a solution was feasible