Without taking sides on the issue, these are purposeful trade-offs that the Go team makes. They are trying to avoid bloating the language and making it too difficult for them to add optimizations or other features. And I think they would argue that it makes ignoring errors harder, since you have to intentionally discard the error value when it was given to you, which takes conscious effort, rather than omitting it from the code completely like other languages let you.
aikah|7 years ago
Trade-offs for whom or with what in mind? the compiler or the programmer?
That's the "philosophical" difference between the Rust team and the Go team.
TylerE|7 years ago
Skunkleton|7 years ago
Even with two wildly different approaches to language design, each has their place, and their own set of drawbacks.
yawboakye|7 years ago
There's also a recommended way of dealing with errors. I may not state it correctly but basically you build a pipeline of operations for a data type that represents the arguments (or data) of the operations. For example, to compress an image given a URL:
geodel|7 years ago
eptcyka|7 years ago
nomel|7 years ago
What are some cases where errors can be ignored? And if they can be, are these neccesarily some sort of "status" rather than "error"?
merb|7 years ago
How likely is the error going to happen, if you know (through tests and everything) that the query is correct?
it can only happen in two scenarios:
1. the database has serious problems 2. the driver is incorrect
in normal cases you would probably handle that with a middleware in classical languages. i.e. you would have a middlewre that catches exceptions and handle the error there (logging, paging, whatever) and maybe show a nice looking "we are experience problems now"-page.
in golang this is a little bit harder, since you would need to handle the error by every caller and with the default http interface you would actually need to call your "handle default error" in every http handler.
sephware|7 years ago
unknown|7 years ago
[deleted]
danmaz74|7 years ago