4 ms·
I won't try Go until it implements generics and changes its hide-error-by-default behaviour.
by knocte 12y ago
I won't try Go until it implements generics and changes its hide-error-by-default behaviour.
- MereInterest 12y agoCompletely agree on the second part. It feels utterly silly that they refuse to use exceptions on the basis that errors should be explicit, but then allow for errors to be silently ignored just by not assigning them to variables.
- NateDad 12y agoIn practice this is not a problem that is encountered pretty much ever. If you are afraid of it, run errcheck[1] on your code, and it'll tell you if you've missed anything. [1] https://github.com/kisielk/errcheck https://github.com/kisielk/errcheck
- MereInterest 12y agoIf you don't mind me asking, what is it that keeps it from coming up? I understand that the multiple return values help, since then you don't need to go with the clunky C-style of passing in pointers that will be used as output. Error codes always feel like they rely too much on everybody deliberately following good coding practice, since the default is to ignore the error code. I prefer using exceptions, because then the error can't be ignored by default, and must be explicitly silenced if it is not desired. Then again, that is a large python influence on me.
- bad_user 12y agoI also think the arguments against using exceptions are flawed. For example it's a common pattern to use a supervisor that catches exceptions and depending on context and severity, to log the errors, to restart the guilty component, to send an error report, to fallback to something else, to crash the whole process and so on. The idea being that unexpected errors happen and you need to react to them in some way, preferably without relying on the developer to do something for everything potentially error prone that he does, because we can't anticipate everything bad that can happen, yet in spite of this, we can make the system resilient to errors.
- touristtam 12y agoIf you really need to have generics, maybe you have no need to use go in the first place. I certainly have very limited use and experience of generics, and therefore I have no strong feeling about them. Despite our respective opinions I have no doubt you will find other developers implementing them in the future.