I have been writing Go daily at work for about a year and a half. It is now my primary language, and my default choice for any new projects, the way Python used to be. Before that, I come from a background in functional programming (and still find functional programming to be my favorite paradigm). It seems to me that there are two disjoint sets of people: those who write Go regularly, and those who complain about ge…
I've written several non-trivial Go programs, the most recent of which was a server that solved substitution ciphers (for use in subtitle OCR). I tried to write nice idiomatic Go code. And I'm usually pretty good at adapting my brain to strange languages—I've positively enjoyed Haskell, constraint programming in Mozart, distributed functional programming in Elixir, and quite a few other strange things. (To be fair, I…
What Go Might Be Like With Generics
31–40 of 49 posts
Re: What Go Might Be Like With Generics
#32Is the only argument that Go users can come up with against generics is that they don't like the syntax? The pretentious nature of the Go community really puts me off from the language, especially when combined with some of the pretentious designs of Go itself.
Is the only argument that Go users can come up with against generics is that they don't like the syntax? Surely that's the best argument?
As pathetic as it is, "syntax bad" is probably the best argument.
Re: What Go Might Be Like With Generics
#33Is the only argument that Go users can come up with against generics is that they don't like the syntax? The pretentious nature of the Go community really puts me off from the language, especially when combined with some of the pretentious designs of Go itself.
No, the argument is that it's unclear how to fit it into the language. Typically, generics are implemented using either code generation (causing code bloat) or type erasure (which requires boxing the type). They're not satisfied with either.
Compare:
map f [1, 2, 3]
map g [1.0, 2.0, 3.0]
Versus: integer_map f [1, 2, 3]
double_map g [1.0, 2.0, 3.0]
In both cases, you wind up with specialized versions of map (one for Integers and one for Doubles). The benefit of the generic version is that the programmer must only implement map once, and the compiler handles specializing it for various types. Without generics, the programmer has to write the specialized version for every type he needs the function for. This creates more tedium for the programmer, and does not reduce bloat in any way.Caveat lector: Though my examples above are written in Haskell, I don't have enough knowledge of GHC internals to know whether it performs specialization this way. Nonetheless, it could be a reasonable approach for Go.
Re: What Go Might Be Like With Generics
#34I have been writing Go daily at work for about a year and a half. It is now my primary language, and my default choice for any new projects, the way Python used to be. Before that, I come from a background in functional programming (and still find functional programming to be my favorite paradigm). It seems to me that there are two disjoint sets of people: those who write Go regularly, and those who complain about ge…
I've read various articles including (but not limited to) tutorials, made a point of exploring a few open source projects and I've written a few thousand lines of Go. I enjoy writing Go, but I have a hard time so far figuring out if what I write is idiomatic.
Re: What Go Might Be Like With Generics
#35Earlier quoted context omitted.
They may not appear that way if you mesh well with the core ideas of Go. I once mentioned that Go does not fit into my usual project setup - I keep git repos in ~/sources. Go requires me to instead dedicate an entire directory structure to my entire Go workspace, which I have to keep seperate from the other sources. This could easily be avoided by letting me set enviornment variables that would relocate some of these…
It is opinionated (a more useful word than pretentious), and it is this way across many things. From style to directory structure to versioning of dependencies to generics. If you actually read the reasoning behind them, I think they are rather well defended by very smart people, but to each their own. If you really have an issue with some of the very opinionated ideas that come to a large degree bundled with Go, tha…
Re: What Go Might Be Like With Generics
#36Is the only argument that Go users can come up with against generics is that they don't like the syntax? The pretentious nature of the Go community really puts me off from the language, especially when combined with some of the pretentious designs of Go itself.
The pretentious nature of the Go community really puts me off from the language I have had the exact opposite experience with the Go community. In particular, I've found community hubs like #go-nuts and the mailing list to be professional at worst and friendly at best, and always helpful. some of the pretentious designs of Go itself. How can a design be pretentious? Either you favor the design or you don't, but calli…
That has not been my experience reading go-nuts. Almost any language improvement idea, however valid, is met with snark and you-re-doing-it-wrong answers. And there have been many, and from quite serious developers over the years.
Re: What Go Might Be Like With Generics
#37Earlier quoted context omitted.
They may not appear that way if you mesh well with the core ideas of Go. I once mentioned that Go does not fit into my usual project setup - I keep git repos in ~/sources. Go requires me to instead dedicate an entire directory structure to my entire Go workspace, which I have to keep seperate from the other sources. This could easily be avoided by letting me set enviornment variables that would relocate some of these…
For what its worth, go the language doesn't force that structure. Go the tool does most of that. Most languages (in their pubescent state) don't have self-referential build tools, and so tools get added by third parties (make, scons, etc). This is not a bad thing -- but it does mean that when a language chooses to ship "opinionated" tools as the default supporting toolset, users gain from the 'convention over code' a…
Re: What Go Might Be Like With Generics
#38Earlier quoted context omitted.
They may not appear that way if you mesh well with the core ideas of Go. I once mentioned that Go does not fit into my usual project setup - I keep git repos in ~/sources. Go requires me to instead dedicate an entire directory structure to my entire Go workspace, which I have to keep seperate from the other sources. This could easily be avoided by letting me set enviornment variables that would relocate some of these…
It is opinionated (a more useful word than pretentious), and it is this way across many things. From style to directory structure to versioning of dependencies to generics. If you actually read the reasoning behind them, I think they are rather well defended by very smart people, but to each their own. If you really have an issue with some of the very opinionated ideas that come to a large degree bundled with Go, tha…
Well, opinionated doesn't mean much quality wise. Either you have the right opinions or the wrong ones. If you have the wrong opinions on something AND are opinionated about it, then you're stupid.
Re: What Go Might Be Like With Generics
#39Re: What Go Might Be Like With Generics
#40I have been writing Go daily at work for about a year and a half. It is now my primary language, and my default choice for any new projects, the way Python used to be. Before that, I come from a background in functional programming (and still find functional programming to be my favorite paradigm). It seems to me that there are two disjoint sets of people: those who write Go regularly, and those who complain about ge…
How would you recommend becoming familiar with idiomatic Go? I've read various articles including (but not limited to) tutorials, made a point of exploring a few open source projects and I've written a few thousand lines of Go. I enjoy writing Go, but I have a hard time so far figuring out if what I write is idiomatic.
Short of that, read the source of some standard library packages. They are quite approachable.