News for hackers. Stuff that matters.
Re:Writing secure Go code by Cthulhu_ on Tuesday November 05, 2024 @04:30AM (#42050005)
There were many proposals but none of them were an actual improvement over the simplicity and straightforwardness of the existing. `if (err != nil) {` is simple, short and to the point, and adding language features for only this use case wasn't deemed worth the cost in the end.
Re:Writing secure Go code by consteval on Tuesday November 05, 2024 @09:22AM (#42051655)
The problem with this syntax is that it's not required anywhere, any time. It also makes the logic extraordinarily complex for what it is. You can very quickly get into branch hell. I hate to say this, but often the control flow is much simpler and easier to understand with exceptions. The "if" works fine for one level, but any deeper than that and it's no fun.