4 ms·
> With an exception (not checked exceptions) you get the advantage of the compiler knows about this and can optimize some code paths while result/checked except
by gpderetta 2y ago
> With an exception (not checked exceptions) you get the advantage of the compiler knows about this and can optimize some code paths while result/checked exceptions need to go into that function anyway.
Once you convert them in CPS form there is really no difference between the two. In principle you could compile both to exactly the same code. [edit: also not sure why are you singling out checked exceptions]
[edit: specifically you could compile any code that returns an Either to a function that takes two return continuations instead of just one, and in CPS form exception-like non-local exits are trivial]
Of course in practice traditional procedural languages do not compile through CPS and use abnormal edges in basic blocks to represent exceptions.
> There are pros and cons to both, so anyone arguing absolutely for either side is wrong
I'm in the camp that, in a well designed language[1], there would be no difference between the two :D
[1] according to my personal preferences that I can assure you are completely objective!