TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Go Is Unapologetically Flawed, Here’s Why We Use It

56 pointsby tylertreatabout 10 years ago

4 comments

mike_hearnabout 10 years ago
The comments about Java are wrong. There&#x27;s an HTTP server in the standard library (under com.sun). It&#x27;s not well known but it&#x27;s there and the documentation is quite reasonable. The API is very simple. I&#x27;ve used it a few times and whilst I wouldn&#x27;t run a major website on it, it&#x27;s fine for smaller tasks.<p>From Java 7 onwards files can be read with a single method call. Look at the static methods on the Files class.<p>I find the article to be poor. He says he likes Go, and then proceeds to illustrate why nearly all the features of it are dubious. Then he admits that any article that criticises Go had to be prefixed with his disclaimer because otherwise the community will get nasty, so does he really like Go? Hard to say. His employer requires him to use it so it&#x27;s not like he can openly say he hates it.<p>Finally he says Java is ghastly, but his only evidence for this is he doesn&#x27;t like one of the frameworks built on it ... a framework that Go has no equivalent to anyway. Ok... so don&#x27;t use j2ee then. Use something like Play or Ninja. He would then benefit from good GC and working debuggers&#x2F;CPU profilers.
评论 #9610450 未加载
breakingcupsabout 10 years ago
I like Go, but I agree with most said in this article.<p>One nitpick about his comment about sending to closed channels. This is indeed programmer error and SHOULD panic, in my opinion. It is clear the author has not read up on the semantics of channels. Channels should only be closed by the sender. If you have multiple senders, how on earth would it be a valid situation for one of these senders to close the channel if the other sender still has data to send? You&#x27;re going to need some form of synchronisation mechanism for this.
评论 #9582137 未加载
4ydxabout 10 years ago
Summary: No generics. No versioning. The author said they wanted to bring more to the conversation, but it seems that they really didn&#x27;t after all.
评论 #9581678 未加载
ngrillyabout 10 years ago
<i>A copy of the comment I posted on the author’s blog</i><p>I agree that generics are very useful when writing reusable libraries, but I disagree they are absolutely necessary when writing and maintaining software at large scale. At large scale, at some point, processes communicate with other processes on the same machine or over the network, and you have to marshal&#x2F;unmarshal and type check at runtime.<p>Your example with the function isInt64InSlice is a good illustration of why the lack of generics is annoying at small scale, but it hardly shows why this is a problem at large scale.<p>PostgreSQL is an example of a complex piece of software, written in C, which doesn&#x27;t use generics and is still very readable and maintainable.<p>A few other technical points:<p>- &quot;Cannot add methods to types from a different package&quot;: Would you want something like extension methods in C#?<p>- &quot;Channels are slow&quot;: I&#x27;ve read there is some work going on to improve them. That said, you admit yourself that Go is still one the best option among the &quot;concurrent&quot; languages. Are you aware of another language with a similar mechanism builtin in the language or the library and that performs better on this matter?<p>- &quot;Accidental implementation of an interface&quot;: I agree this a problem in theory, but in practice it&#x27;s very rarely an issue. Have you been beaten by that often? Do you think the benefits of implicit implementation are not worth it?<p>- &quot;Cannot implement your own exceptions&quot;: Yes you can. You can pass some value to panic and retrieve it upper in the call stack with recover and decide what to do depending on the value. It&#x27;s not something Go developers do often, but there is some use of this technique in the standard library for example. It&#x27;s explained in &quot;Effective Go&quot;.<p>- &quot;Map returns a bool instead of an error&quot;: I don&#x27;t see the issue here. A lot of other languages do the same and return a default value and&#x2F;or a boolean at false when you probe a map with a missing value.<p>- &quot;Adding an item to a closed channel panics&quot;: This is a programming error, like a division by zero or an out of bounds array access.<p>- &quot;Channels as iterators&quot;: Goroutines and channels are not designed to build iterators. They offer a general low-level mechanism for concurrency. How would you expect the goroutine to know that nobody is listening anymore and shutdown?<p>About the community, I would not call it &quot;stubborn&quot;. In my experience, it is generally helpful and very professional. But I agree that the topic of generics has become a taboo, which I regret. It looks like the core team wants to focus on improving the compiler, the runtime, the library, the tooling and the garbage collector, and because of that wants to keep the language stable in the meantime. I understand the frustration, but don&#x27;t you think their decision makes sense and is the best way to use the limited resources of the core team?<p>You wrote that &quot;a language can have considerable depth while still retaining its simplicity&quot;. What languages would you recommend that solve the flaws of Go while preserving its simplicity (in terms of user experience)? It&#x27;s a sincere question. I&#x27;d like to use such a language.<p>More generally, you ask how can we make developers more productive and how can we enable them to solve problems? That&#x27;s interesting because this is precisely the question Go tries to answer. Are you sure the answer lies in a more powerful programming language? What about the runtime, the tooling, the libraries?<p>The Go team thinks the answer lies in simplicity (light syntax, garbage collection, interfaces, composition over inheritance, builtin arrays&#x2F;slices&#x2F;maps), builtin concurrency (goroutines, channels), great tooling (speed of compilation, go test, gofmt, godoc), easy deployment (no virtual machine, static binary).<p>Do you think the answer lies in having type parametricity, algebraic data types, pattern matching, immutability, Hindley-Milner type inference, higher kinder types, etc.? I&#x27;m not saying they are not useful or desirable. I&#x27;m just saying that the low hanging fruits in terms of developer productivity may be elsewhere.