r/transprogrammer • • Jul 20 '24

Implementing exceptions

Just wanna know if anyone knows a more time-efficient way of implementing exceptions in a language than this or sees any issues with this design :3

(I know this flow chart sucks, sry)

handlethrow would exist separately for each try-catch clause

(obv this will only work for x86 but smth similar should work for all major architectures)

15 Upvotes

25 comments sorted by

View all comments

Show parent comment

4

u/ato-de-suteru Jul 21 '24

if ppl wanna write shitty code they're gonna write shitty code and there isn't a whole lot that can be done about it.

Lol, fair enough. I've run across plenty of libraries that are shitty enough to neither document when they throw their own exceptions nor to handle stdlib exceptions they throw themselves. Every time I do, I wish dearly that my LSP could have warned me that a exception_type_a was possible.

1

u/definitelynotagirl99 Jul 21 '24

yee i feel you, resolving that must be horrible, i wouldn't know tho, i avoid other peoples code, and as a consequence, libraries, like the damn plague and fortunately stdc++ is actually half decent about telling you what exceptions its gonna throw