Re:Go Replaces Interface{} with 'Any'
by nvarsj on Tuesday December 14, 2021 @05:40PM
(#29559113)
Yes, please, the iferr pattern drives me nuts. While I built a few years of my career on golang, I'm absolutely sick of the language at this point. At least we finally get generics.
[ Parent
| on HN ]
Re:Go Replaces Interface{} with 'Any'
by politician on Tuesday December 14, 2021 @09:18PM
(#29561245)
Writing code for the happy path is 1/100th of programming. Maybe less.
There is a reason very robust software is written in C: no exceptions means you think about normal errors all the time and reason about what the difference bwtween an error openjng the file and an wrror writing the file. Sqlite, linux, cpython, all bullet proof and all C. The lack of exceptions more than makes up for memory unsafety issues.
Bullet proof you say, https://www.cvedetails.com/vulnerabilities-by-types.php
Re:Go Replaces Interface{} with 'Any'
by Cthulhu_ on Wednesday December 15, 2021 @04:51AM
(#29563849)
What alternative do you propose?
There's many options, just look at other modern languages. The simplest are exceptions/errors that can be thrown - like you get in Java, python, typescript, etc. For something more like a traditional return value, you have std::result in rust, and error union types in zig, with language support to guarantee you check and handle the result. In C, you have macros and goto that can be used to reduce boilerplate and implement whatever pattern you want.