Re:Examples of beautiful Go?
by blablabla123 on Friday March 15, 2013 @06:30AM
(#5379882)
>I am still a Go newbie, but my initial impression is that certain constructs make it more difficult to write beautifully than it should, which only serves to detract from the readability (not talking clever one-liners here – which shouldn't even come up in beauty discussions). However, given that I am new to the language, I may just not be yet able to express things as well as I could.
It depends very much on what you want to write. If you want to write something related with File I/O or Network I/O in a reliable fashion, chances are that you cannot see it more beautifully implemented than in Go. No big surprise, the language designers are known for being involved in a lot of Unix stuff.
On the other hand, if you want to implement a linear algebra package that has support for a lot of structures, you will see less beautiful code. The same is somehow true for a number of algorithms that act on collections. There are no templates, so you either Copy&Paste or you work with interface{} worst case, meaning such code is cluttered with type assertions.
But besides that, I think most Go code can be made beautiful. It definitely has its sweet spot in Server Programming.
It depends very much on what you want to write. If you want to write something related with File I/O or Network I/O in a reliable fashion, chances are that you cannot see it more beautifully implemented than in Go. No big surprise, the language designers are known for being involved in a lot of Unix stuff.
On the other hand, if you want to implement a linear algebra package that has support for a lot of structures, you will see less beautiful code. The same is somehow true for a number of algorithms that act on collections. There are no templates, so you either Copy&Paste or you work with interface{} worst case, meaning such code is cluttered with type assertions.
But besides that, I think most Go code can be made beautiful. It definitely has its sweet spot in Server Programming.