Re:Goro – An implementation of PHP written in Go
by bouncycastle on Monday November 26, 2018 @09:13PM
(#18538746)
Yeah, but an error error is not really an exception. Often in Go, errors are used to mark different states, such as EOF which are expected and you can deal with locally and have more control whenever you want to return or not, for example, you can test the error in the same if condition and decide whenever to keep going - usually you do. Error handling code is more local rather than all over the place, plus no need to declare more classes for specific exceptions.
[ Parent
| on HN ]
Re:Goro – An implementation of PHP written in Go
by dymk on Monday November 26, 2018 @11:58PM
(#18539520)
> Often in Go, errors are used to mark different states, such as EOF which are expected
Then it's not an error, and Go has once again forced people into writing something semantically confusing and/or incorrect because it lacks basic abstractions.
Re:Goro – An implementation of PHP written in Go
by bouncycastle on Tuesday November 27, 2018 @02:34AM
(#18540288)
Actually, any type can be an error, just as long as it impliments the Error interface. Go is more about interfaces - if some type impliments some interface, then that's what it is.