@h top of the line:
Go has everything except a good language.
@h @privateger @scubbo I’m not so sure about this since everyone uses linters which should flag this.
right?
crickets
right????
@h "you can always forget to use a try-catch" - how? Even if your linter doesn't catch it, that's just a straight-up compilation failure in type-safe languages, right?
(Not trying to "No True Scotsman", here - when I say "type-safe languages" I'm explicitly not thinking JavaScript or Python, where types are optional-at-best)
In fact I thought
@privateger 100% with you on the first paragraph - that's a bad practice, for sure, and I agree that it should be discouraged.
I need a bit more insight to understand the 2nd para, though. How does returning an error _let_ you do those things, in a way that you cannot (note - "cannot", not "don't, in practice") do with thrown exceptions?
(If the claim is actually "both approaches have equal maximal specificity, but explicit per-function error-handling promotes better practice", then I buy it!)
@h @Seirdy That's mostly because try/catch is a very weak paradigm for error handling and profoundly limiting.
The #CommonLisp #ConditionSystem is rather the way to look.
@Seirdy @h That works right up until you have to rely on hardware systems that can fail.
So even in Ada SPARK (which has such formal verification apparatus) you still need to handle such failures.
But more importantly, the Condition System isn't solely limited to signaling error conditions, it can be used to handle a variety of other conditions. You can also vary how you decide to respond to them (if at all), and you can even make that dynamically configurable.
@Seirdy @h I will never forgive Intel. <insert anime meme>
Seriously though, it should be the least of things for the CPU and memory to be both able to detect and *correct* errors, and signal faults to the operator.
Mainframes do it. They also support hotswap of the components involved.
Workstations fail on the hotswap and CPU fault tolerance parts.
PCs fail on everything. Thanks Intel⸮
At least even on PCs it's possible to put redundant and hot-swappable storage.
@Seirdy @h Something file/record-aware does best, as you can only correct the one record that has gotten corrupted (like ZFS & btrfs do).
Then you can also do things like storing said records on blocks of a given size so you can more easily support diverse hardware while respecting policy constraints the user configured (btrfs uses 1GB blocks, which means you don't have to use identically-sized or larger drives in tuples, it dynamically allocates according to the profile constraints).