News for hackers. Stuff that matters.
Re:I want off Mr. Golang’s Wild Ride (2020) by preseinger on Friday April 29, 2022 @10:18PM (#31212771)
Error handling is basically orthogonal to performance.

If a function call can fail, it should return an error, and that error should be managed by its caller. Any other approach means callstacks are unpredictable, which makes a program way way harder to model.

Re:I want off Mr. Golang’s Wild Ride (2020) by throw10920 on Sunday May 01, 2022 @08:22PM (#31230070)
> that error should be managed by its caller

Objectively false. Correct answer: the error should be managed by the code that makes sense to handle the error.

> Any other approach means callstacks are unpredictable

Also false. I use conditions regularly, and my callstacks are very predictable - errors bubble upward through the call tree until they're handled. There's nothing simpler.

> which makes a program way way harder to model

Also false. I have no problem at all modeling and understanding my code rife with conditions.

Re:I want off Mr. Golang’s Wild Ride (2020) by preseinger on Wednesday May 04, 2022 @08:23PM (#31267746)
You're wrong on every point. I don't know how to speak to you given the strength of your conviction, so shrug
Re:I want off Mr. Golang’s Wild Ride (2020) by throw10920 on Wednesday May 04, 2022 @10:38PM (#31268716)
I think the fact that you didn't actually refute any of my points speaks volumes about which of us is correct.
Re:I want off Mr. Golang’s Wild Ride (2020) by preseinger on Friday May 06, 2022 @10:53PM (#31291763)
What do you mean by "conditions"?

> errors bubble upward through the call tree until they're handled. There's nothing simpler

Between

    output_a := f1(input_a)  // f1 throws exceptions on error
    output_b := f2(output_a) // f2 throws exceptions on error
and

    output_a, err := f1(input_a)
    // inspect and deal with err
    output_b, err := f2(output_a)
    // inspect and deal with err
it seems uncontroversial to me that the latter is less complicated than the former, and easier to model control flow paths.

Exceptions make sense in a lot of contexts! Just not services, servers, or long-lived processes.