πŸ’¬ Reply by TimeSquirrel

2024-11-14 πŸ”„ programmerhumor ┃ RE: yogthos

I'm just a hobbyist but...are you guys using exceptions like they're conditional statements??

TimeSquirrel

https://kbin.melroy.org/m/programmerhumor@lemmy.ml/t/563221/-/comment/4884265

yogthos

πŸ”„ programmerhumor

πŸ’¬ Replies

2024-11-14 Ephera

You don’t want to use exceptions in normal control flow, because they’re extremely slow. Every time you throw an exception, it has to collect a stacktrace, which is hundreds, if not thousands, […]

2024-11-14 tunetardis ┃ 1πŸ’¬

I suppose it depends on the language? For the most part I think you’re right. Exceptions are only used (if at all) in situations where a program diverges unexpectedly from its normal flow. But […]

2024-11-14 sbv ┃ 1πŸ”—

I thought those were for only when shit is seriously wrong and execution can’t continue in the current state.
[…]

2024-11-14 Odinkirk

You can set up a global exception handler in some frameworks. By having multiple (not a crazy amount) of exceptions, you can set up logic for how to handle that kind of error. Then you can just […]

2024-11-14 yogthos

As a rule, exceptions should indeed be used for behaviors that are outside normal execution flow. For example, you might throw an exception if a file you’re trying to access doesn’t exist, or a […]

────

View parent post

────

πŸ“‘ Local feed

πŸ•οΈ Communities

πŸ”₯ Hashtags

πŸ”Ž Search posts

πŸ”‘ Sign in

πŸ“Š Status

πŸ›Ÿ Help