5 ms·
Go is successful because it's exactly what Google needs to write back-end code. It's (almost) memory-safe. It comes with a set of well-debugged libraries for d
by Animats 10y ago
Go is successful because it's exactly what Google needs to write back-end code. It's (almost) memory-safe. It comes with a set of well-debugged libraries for doing most of the things you need to do on a web server. That's good enough for most web-related work.
From a language theory perspective, there's a lot to criticize about Go. The "goroutine" and "channel" thing turned out to be less useful for general concurrency than expected. But it's good enough to service lots of network connections. The lack of generics means that functions like "sort" are painful. But you can still get sorting done; it's just clunky.
Haskell hasn't taken over the world because it's designed by theorists for theorists. It's too clever, or, "l33t", like LISP. Also, anything interactive is dominated by I/O, while the functional model is better matched to pure computation. The IT industry today is mostly I/O dominated interactive applications.
(It's not clear yet if Rust is "too clever" for widespread use. The jury is still out.)
- bsaul 10y agoI agree on the general point that go is simple and familiar, but it's absolutely not memory safe ( and as you said, channel is really not working as well as expected in practice, unless you start using them as actor mailboxes, which i don't think was the original point). Actually, seeing all those panic on null pointers was really my first surprise when i started coding in go ( and really first disappointment).
- kazinator 10y agoPanics on null pointers don't indicate that the language isn't memory-safe. Lack of memory safety means that misuses of memory go undiagnosed, with unpredictable results. (Not to mention that they are allowed in the first place, with features like arrays that blindly allow oout of bound access.) A null pointer indicates a memory problem only if it is the field of a memory object that was wrongly overwritten with zeros, giving rise to the null value in an invalid way. If the null value was correctly assigned, then it isn't a problem in the memory safety category. If Go diagnoses all null pointers with panics, that makes it safer than C, whose implementations require on the virtual memory hardware to catch null pointers. An expression like ptr->member in C will onlyl segfault on a null ptr if the member displacement is within 4096 bytes, or whatever is the virtual memory page size. If memb is offset beyond the unmapped zero page, then some memory is silently accessed or overwritten. Not to mention that on systems without VM hardware, ptr->member just silently works when ptr is null, for any struct type. I don't program in Go, but as far as I know, panic is a kind of high level exception handling feature in Go. So it sounds like you should be able to write Go code which expects that null pointers will occur in some object field or parameters, and just use panic/recover to trap it all in one place instead. In C, you would need platform-specific coding to do anything similar, like catching a SIGSEGV in POSIX or a structured exception in Win32. Yuck!
- deleted 10y ago[deleted]
- Animats 10y agoGo is almost memory safe. There are two known areas where race conditions can break memory safety - maps (that was on purpose, as a possibly premature optimization) and shared slice descriptors (a design bug).
- jholman 10y agoCan you say a little more, or provide pointers to resources that you find credible, about "The 'goroutine' and 'channel' thing turned out to be less useful for general concurrency than expected"? I'm less interested in criticism of Go-the-language, and more in general criticism of CSP, or of CSP-as-implemented-in-Go, whichever you think applies.
- di4na 10y agoYou will have a hard time finding it, because nearly all "mainstream" language use that subset of CSP. I am still working on explaining it well myself, but i am working on trying to write blogpost about it. My main problem with CSP concurrency is simple : synchronisation. That does not work in face of possible errors. Period. The only way to make it work without breaking the laws of physics so much is to bet that there is no hardware errors and that everything stay single threaded. Generally, look at the body of work against RPC and about consensus in distributed systems. Because your computer itself is a distributed system. It just happened that it hide it well for decades, but not anymore. We are even seeing timing problem between cores in some chip.
- bostand 10y agoSome of the most fanatic Haskell supporters I have met have been university professors that have not written a single line of "production" code in their life. They thought Haskell would eventually rule the programming world because <insert cute language feature>.
- majewsky 10y agoThat matches up quite nicely with what the article says. Haskell is well-suited for applications that have complicated computations going on inside of them, but which provide a relatively small surface to the impure world outside the program ("CRUD apps", as the author notes). And universities are a place where you come across a lot of computationally difficult problems. (Case in point: I learned Haskell in a lab course called "Haskell for Natural Language Processing", and the instructor noted that the NLP group does all their programming in Haskell.)
- kazinator 10y agoGoogle is the key operative word there. Without backing/promotion from Google, Go would be completely obscure and disused. Google could promote a language that is a complete piece of crap and it would be instantly more successful than something well-engineered from some unknown hackers.
- hactually 10y agoI'm gonna go and say Bullshit on this one. Python, C, C++ all had promotion from usage more than anything else and the same is true of Golang. It is a language that attracts a community. I would rather thank Google for letting their engineers use it and develop it than cast unproven aspersions.
- kazinator 10y agoSince Python and C++ were not successful due to promotion by Google (but for other reasons), you do not have a logically deductive counter-argument here. Your counterexamples speak nothing to the validity of the proposition "if Google promotes something, it will likely be successful". They are counterexamples to the ridiculous proposition "If, and only if, Google promotes something, it will be successful".
- crystalPalace 10y agoWhat about Dart(https://www.dartlang.org/ https://www.dartlang.org/)? Dart is developed by Google and has features that are tailored for or lend themselves to specific modern use cases i.e. IoT, mobile, and web applications. The language is only two years younger than Go but as far as I can tell has attracted nowhere near the community or adoption.
- blacksmythe 10y agoI can't find the reference, but I recall someone saying that Dart has huge adoption measured by revenue resulting from its use as an internal Google sales tool. https://news.ycombinator.com/item?id=7955819 https://news.ycombinator.com/item?id=7955819
- caconym_ 10y agoIt's been a while since I last used Haskell but I remember its I/O story actually being pretty good. The fact that I/O must happen in the IO monad doesn't prevent you from doing it; it just gives you better tools to reason about it. I wish Haskell "advocates" would give it a rest with banging the "purity" drum and tossing out gee-whiz examples of "elegant" code with no relevance to practical programming. I found it to be a very practical language, not without flaws, but also with powerful arguments in its favor for certain sorts of applications.
- codygman 10y agoI upvoted you for the IO part of your comment, but contend purity is a very big feature. More focus needs to be on reasoning about real world tasks where is needed though.