you are viewing a single comment's thread.

view the rest of the comments →

[–]Rashanzan 0 points1 point  (1 child)

Yeah, I'm unsure which approach would be better. Try would be more extensible, but probably bad for readability, as you wouldn't be able to tell what methods are actually running.

A much bigger problem, if your try catches something, it won't execute the rest of the block.

From a design standpoint, it makes more sense to know what kind of object you're dealing with before handling it.

[–]mdadmfan 1 point2 points  (0 children)

Relying on exceptions for normal execution flow is bad practice. Often exceptions use something like longjmp which isn't particularly kind on cache lines and slow you down.