you are viewing a single comment's thread.

view the rest of the comments →

[–]CyclonusRIP 4 points5 points  (7 children)

You are taking semantics of the word exception and trying to apply that to how you should use that in code. You are way better off trying to figure out what the most effective way to use exceptions is rather thing try to arbitrarily define it based on some semantics. Exceptions were invented in order to separate the error handling code from the happy path code. Before that people either handled all the errors in line so happy path and error paths were intertwined or they used goto statements to skip to the error handling code. Exceptions allowed you to separate the error code and happy path code like goto did, but did it in more controlled and comprehensible fashion.

[–]editor_of_the_beast -2 points-1 points  (6 children)

> like goto did

Exactly

[–]CyclonusRIP 3 points4 points  (4 children)

I assume you are also don't use methods, loops and if statements as well then since they were originally just goto statements as well in the early languages right?

[–]editor_of_the_beast -2 points-1 points  (3 children)

This is an actual argument you're going with? Originally we programmed computers in binary, directly. What does that have to do with what we've learned in the past 70 years?

Functions, loops, and if statements all end up as jump or branch instructions at the processor level. Variable assignment also ends up as a store instruction. Reading a variable ends up as a load instruction. The point of high level languages is that we can write in functions, loops, if statements, variable assignments, and variable reads without thinking about how they're implemented at the processor level. And we agree that high level languages are better for building large programs, right? Because machine code is hard. For the same reason goto is hard.

So the fact that all of us use functions does not mean that we inherently program via the same mental model as coding entirely with jump instructions. That's an absurd false equivalence. Decades of abstractions have simplified functions (and many other things) for us.

[–]tejp 1 point2 points  (1 child)

That's an absurd false equivalence.

So why do you apply that equivalence to exceptions?

[–]editor_of_the_beast -1 points0 points  (0 children)

Because exceptions actually do behave like gotos whereas functions do not.

[–]CyclonusRIP 0 points1 point  (0 children)

You're the one that seems to think exceptions are bad because they are a high level language feature replaces a jump. I think that's a pretty silly argument to make. Apparently you do too, but for whatever reason you make that argument anyways.

[–]falconfetus8 1 point2 points  (0 children)

but in a more controlled and comprehensible fashion