646 karma · joined December 4, 2020
Edit: I do love the analog buttons in the interior though. I despise those big screens with all the controls, and no tactile feedback.
If I had a magic wand, the only things I would add is better nulability checks, add stack traces by default for errors, and exhaustive checks for sum types. Other than that, it does everything I want.
Maybe that's also what will happen with AI investors when the bubble pops or deflates.
result := InvokeWithErrorLogger(
func (err error) { // Error handler
incrementMetric("foo")
log.Error("bar")
},
addTwoNumbers, a, b,
)
But the problem is that this approach is not better than just writing this, which doesn't need any new fancy addition to the language: result, err := addTwoNumbers(a, b)
if err != nil {
incrementMetric("foo")
log.Error("bar")
return fmt.Errorf("addTwoNumbers(%d, %d) = %v", a, b, err)
}
Hence why all the proposals ended up dying with the lack of traction.Error handling in Go is not just writing "if err != nil { return nil, err }" for every line. You are supposed to enrich the error to add more context to it. For example:
result, err := addTwoNumbers(a, b)
if err != nil {
return fmt.Errorf("addTwoNumbers(%d, %d) = %v", a, b, err)
}
This way you can enrich the error message and say what was passed to the function. If you try to abstract this logic with a "Handle" function, you'll just create a mess. You'll save yourself the time of writing an IF statement, but you'll need a bunch of arguments that will just make it harder to use.Not to mention, those helper functions don't account for cases where you don't just want to bubble up an error. What if you want to do more things, like log, emit metrics, clean up resources, and so on? How do you deal with that with the "Handle()" function?
You can also add additional context to the error before bubbling it up. But yes, that part of the point. Instead of bubbling them up, the programmer should instead reflect on whether it is better than just log and proceed, or completely swallow them. This is what error handling is about.
Why on earth would you be on the side of a country like this? Why we should be an ally of the US right now, if Trump can't even uphold agreements he signed himself 5 years ago? What guarantees do we have that, as soon as we decouple from China, the US won't treat us as a vassal because we gave up our only alternative? The only rational choice is to either be neutral or ally with China.
For the younger folks who organize their parties by texting (iMessages, Whatsapp, Telefram, etc), this can be enticing.
It seems to imply that root cause analysis was previously only taking into consideration individual components and only machine-to-machine interactions, and a better approach is to also take into consideration how systems interact with each other, as well as human operators.
Maybe that's true for Google, but I don't think this is the "a-ha" moment the author thinks it is. If you are just looking at how two components can fail while interacting, then obviously you are leaving out a huge part of the equation. I don't see why we would need another aconym jargon for this.
Will I actually do it? That's irrelevant. I may decide to live and fight as much as possible, and that's fine, but I want the option.