It is kind of boilerplatey, but I find myself stopping to consider how best to manage an error vs languages with exceptions.
https://learning-rust.github.io/docs/e6.combinators.html
https://learning-rust.github.io/docs/e5.error_and_none_propa...
Edit: I left out "engaged in" previously.
for _, a := range albums {
if a.ID == id {
c.IndentedJSON(http.StatusOK, a)
return
}
}
is ugly compared to a much more readable : for a in albums:
if a.ID == id:
// the rest of the code
or albums = append(albums, newAlbum)
is ugly compared to albums.append(newAlbum)
Edit : I have trouble formatting the code. How do you do this on HN ?` doesn't seem to work.Edit 2 : Fixed the formatting issue.
albums = append(albums, newAlbum)
implies immutability. I like that. The latter does not. I don't like that. Beauty is in the eye of the beholder.Except that implication is incorrect -- slices are mutable.
What kind of formatting can you use in comments?
http://news.ycombinator.com/formatdoc
https://news.ycombinator.com/formatdoc:Text after a blank line that is indented by two or more spaces is reproduced verbatim. (This is intended for code.)
Saddest part is that it’s actually pretty good language at getting things done, you just have to hold your nose and pretend it was invented in early 1980s, before the industry figured out good, clean solutions to many problems, and converged on them. Otherwise, to think that someone thought nil (that is, not empty) arrays, or returning value/error as pair instead of tagged result union, or lack of generics, is a good idea on 2000s, is just unconscionable.