https://github.com/MagicalTux/goro/blob/3cb3dfe0eef910c03e41...
More php interpreters is of course nice.
https://github.com/MagicalTux/goro/blob/3cb3dfe0eef910c03e41...
More php interpreters is of course nice.
if err != nil {}
You get used to that pretty quickly in Go, but it still looks messy to a lot of people.
But alas, those are the choices that the Go language made.
Compare it to another modern language such as rust. Go does not have a stdlib mechanism for converting error types into each other (akin to rust's Into), it doesn't have the idea of mapping values together (akin to rust's carrier operator which is basically like monad do syntax), it doesn't have a way to create a list of errors by default (akin to 'cause' in rust), it doesn't have a way to generate concrete error types for your functions (like the 'failures' or 'error-chain' libraries in rust, which can't be written in go due to a lack of macros and generics and sum types).
It doesn't have a way to match on all possible concrete error values (akin to 'match' in rust or other sum-type things) or to do thing slike '.and_then' or '.map_err' or so on.
Go's error handling is downright insulting in a language that wasn't built at the same time as c.
Exceptions are one reason other languages don't need this "if err throw err" code, without making a comment on if either is superior.
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.
For example, in rust you could use:
let res1 = w.Write(...)?;
let res2 = w.Write(res1)?;
In haskell, you can use do notation or monad binding to do a similar thing.Of course C doesn't have a good type system that allows this sort of thing; it was created before such type systems were well known.
I would expect any modern language to at least recognize that there are good ways to sequence and compose types.