3 ms·
I don't see much distinction between the two because either way you have to change the signature of your function and add a bit of boilerplate at every call sit
by mightyham 2y ago
I don't see much distinction between the two because either way you have to change the signature of your function and add a bit of boilerplate at every call site to handle the error or pass it along. I think the only meaningful difference between result types and throwing semantics is that result types work with expressions, which are arguably more concise, while throwing semantics work with entire blocks, which can be more useful in some cases.