News for hackers. Stuff that matters.
Re:What will be the legacy of Go? by threeseed on Saturday November 14, 2015 @07:16PM (#10567886)
I think Go will ultimately be remembered for reaffirming the importance of single binary deployments.

The world of deployments e.g. build scripts, containers, extravagant tools are all unnecessary with Go. And I suspect future languages will learn from this.

The language itself not much. It doesn't offer anything new that Java 1.0 with Quasar doesn't already have.

Re:What will be the legacy of Go? by farrisbris on Saturday November 14, 2015 @07:29PM (#10567929)
I think the single most important 'thing' go offers is his third point. The removal of the thread. The ability to very easily run multiple concurrent pieces of code cannot be understated. I have my grievances with go as i do with every other language, but what makes me more or less automatically start most new projects in go is that i know that at some point i will probably be sending the same http request to N servers or some variation of a similar task, and even if it can be made to work in any other language, the ease of which it is done in go keeps me coming back.

As an aside i think the composition over inheritance argument deserves a mention. The io.Reader and io.Writer interfaces () and their close friends io.ReadCloser, io.ReadWriter etc) have completely transformed how i approach tasks that involve shifting data through a number of whatevers.

Re:What will be the legacy of Go? by ridiculous_fish on Saturday November 14, 2015 @09:04PM (#10568195)
What do you mean by "removal of the thread?" Go is multithreaded and is vulnerable to classic thread-safety issues, like races and reentrancy.
Re:What will be the legacy of Go? by mkup on Sunday November 15, 2015 @06:35AM (#10569326)
Go runtime library contains user-space scheduler which maps lightweight Go threads to heavyweight OS threads in M:N manner. By the way, Go runtime library allows running user code in only one OS thread per process, all other OS threads must be in the state of blocking system call. So, no mutexes / interlocked instructions are required to access global data from goroutines, but this comes at the cost of reduced parallelism compared to C/C++ (which author of original article seems to be unaware of).
Re:What will be the legacy of Go? by aws_ls on Sunday November 15, 2015 @09:48AM (#10569727)
I doubt if this is totally true. Upto Go version 1.4, the process would use only 1 core/cpu per process by default, but you could change it by:

numCPU := runtime.NumCPU()

ret := runtime.GOMAXPROCS(numCPU)

From 1.5 the process the default value of MAXPROCS is total CPUs on the machine.

So its not 'reduced parallelism compared to C/C++' rather the concurrency infrastructure (channels etc) makes it transparent to the programmer. I don't have to worry about creating a threadpool myself like C/C++ and Java. So overall there is a net gain, in my understanding. Am I wrong any where in this?

Re:What will be the legacy of Go? by NateDad on Sunday November 15, 2015 @09:32AM (#10569685)
Wow, uh no. You're 100% wrong, unless I'm misunderstanding you. You can absolutely have user code running on N threads simultaneously (where N is the number of cores of your machine). And you definitely do need mutexes.

Your statement holds only if GOMAXPROCS is 1, which granted used to be the default, but was always able to be increased, and the default now is the number of cores on the machine.

Re:What will be the legacy of Go? by mkup on Monday November 16, 2015 @07:54AM (#10574106)
Ah, now I see these things changed recently. I wrote original comment because at the time of Go 1.1 or 1.2 my colleague wrote racy code which accessed global variable without mutexes. I tried to educate him to use mutexes, by reducing his code to the minimal version demonstrating race condition, but failed. Then I digged into the source code of Go runtime library and discovered that only one thread could be in the running state at any moment (other threads could be in the state of blocking system call).

So, things changed since that time. OK, nice to see Go evolves. Interesting, how many code in production got broken during upgrade to Go 1.5 due to this backwards-incompatible change. Overall situation seemed totally reasonable to me at that time: Go is a language for average programmer, so it should prefer safely over runtime performance; and coding cowboys who are comfortable with mutexes, interlocked instructions, memory barrier instructions, and lock-free data structures will use C/C++ anyway.

Re:What will be the legacy of Go? by tcard on Tuesday November 17, 2015 @06:05PM (#10584667)
But that wasn't true either at the time of Go 1.1, nor ever I believe. It was the _default_ behavior to have a single core running at a time, but you could just tweak that with the [GOMAXPROCS](https://godoc.org/runtime#GOMAXPROCS) variable, documented everywhere. (That's what changed in Go 1.5; now the default for GOMAXPROCS is the number of cores in the machine.)
Re:What will be the legacy of Go? by gtremper on Saturday November 14, 2015 @10:20PM (#10568346)
He's referring to interacting with goroutines rather than system threads directly.
Re:What will be the legacy of Go? by eropple on Saturday November 14, 2015 @11:06PM (#10568441)
Which Go neither invented nor seriously popularized, unless we are to rewrite history to ignore the actor systems in common use on both the CLR and the JVM (to say nothing of Erlang et al, but "popularized" rather rules that out) well before Go's public release.

Unless the qualifier is "popularized among Ruby and Python people," and, well, sure, but the number of Prometheuses to bring fire to those folks is large and ever growing.

Re:What will be the legacy of Go? by hacknat on Saturday November 14, 2015 @11:35PM (#10568508)
Go didn't invent co-routines, but the primitives of channels and the select statement that go along with them, while not ground breaking, amazingly simplify a lot of concurrency patterns that can get overly bloated and/or difficult to reason about in other languages.

I have simply never seen another language that makes it as easy as Go does to reason about parallelism/concurrency (maybe Erlang).

Re:What will be the legacy of Go? by eropple on Sunday November 15, 2015 @12:20AM (#10568583)
Languages don't need to make parallelism and concurrency easy if they're sufficiently expressive by themselves. Go bakes in things that a competent programmer doesn't need baked, while ignoring things that make a competent programmer better at their jobs (yes, it's the generics problem again!). Making channels primitives isn't a positive to me when it's something I can implement as well or better in userland--which I can, even in a language as middling and Java-1.1y as Go.

Go's channels are effectively a locking message queue (Java's had one of these since at least Java 5) plus a (usually global) thread pool. Not too long ago I implemented the moral equivalent in C++11, using only the standard library and in a unit-testable format, in forty-eight lines. Selecting across them is nice syntactic sugar, but is likewise able to be mimicked in plenty of other languages. Or, alternatively, I can use way more pleasant abstractions like Akka or Celluloid in not-Go languages (sending up Erlang when Akka provides a very similar experience in Scala or Kotlin--even Java, if you're using Java 8--is...curious).

I guess you can make an argument for TOOWTDI, but I don't find that to be persuasive when the OW in question is middling.

Re:What will be the legacy of Go? by kasey_junk on Saturday November 14, 2015 @11:52PM (#10568544)
This is an attitude I've encountered before & can't really get my head around. Channels are a really bad implementation of a queued message concurrency pattern that has been standard in other languages for years.

The select pattern maps directly to any number of interupt style programming abstractions that are available in every language I've programmed in the last 15 years.

Quite simply I find the go concurrency story primitive to the point of painful. I'd love to figure out why my opinion on that is so far outside the common refrain

Re:What will be the legacy of Go? by meowface on Sunday November 15, 2015 @02:31AM (#10568832)
While channels definitely aren't anything new, and are just a renamed locking queue structure, why do you say they're "a really bad implementation"?
Re:What will be the legacy of Go? by kasey_junk on Sunday November 15, 2015 @08:28AM (#10569540)
They don't scale well because of lock contention, the syntax is missing standard concepts like timeouts etc, & the behavior around edge cases around initialization, closed channels, nil values etc is bizarre.
Re:What will be the legacy of Go? by azth on Sunday November 15, 2015 @11:00PM (#10572542)
Aren't they "lock-free" though?
Re:What will be the legacy of Go? by kasey_junk on Monday November 16, 2015 @12:39PM (#10575765)
Not in the least. They are a thin veneer on top of a giant mutex.
Re:What will be the legacy of Go? by azth on Monday November 16, 2015 @02:53PM (#10576722)
That's quite disturbing :P Any idea why they didn't implement channels as a lock-free list, ala java.util.concurrent.ConcurrentLinkedQueue?
Re:What will be the legacy of Go? by eropple on Monday November 16, 2015 @04:17PM (#10577230)
I don't presume to speak for Go's developers, but I would guess because it's not that big a deal, especially in a cooperative environment. "If I can't obtain the mutex, yield" is a perfectly defensible thing, and is easier to write and probably to maintain than a lock-free list.

Having Java's concurrent stuff is nice, don't get me wrong, but I can understand it not being the biggest priority in the world to go rebuild that later. As I've mentioned elsewhere in this thread, there are much bigger beefs.

Re:What will be the legacy of Go? by xorcist on Sunday November 15, 2015 @06:02AM (#10569268)
What other mainstream programming language has a queue pattern built right into the language itself?
Re:What will be the legacy of Go? by eropple on Sunday November 15, 2015 @12:10PM (#10570187)
What is the value of building something like that into the language? Why should a language have a "queue pattern" built into the language itself? Go has to have channels as a primitive to be usable in 2015 because its lack of generally-accepted features makes it impossible to do the same in userland. Same with its lists, same with its maps. I don't need it built into C++ or Scala or Java/Kotlin or C# or D, because these languages aren't unwilling to let me do it myself (but in all cases there are standard libraries to help me do it, even in the cases where it is not expressly already available).

You are implicitly casting as something to be praised one of the greater missteps of Go.

Re:What will be the legacy of Go? by xorcist on Sunday November 15, 2015 @06:18PM (#10571690)
Missteps is a bit harsh, don't you think? Like them or not, channels and goroutines are quite integral to the Go language. And I think it's perfectly clear it's put in on purpose, and that it does guide the design of software written in the language.

You could perhaps compare it to Python, where async functionality has a solid and well established userland implementation in Twisted, but where asyncio still made a big splash around the community. Language constructs matter.

Re:What will be the legacy of Go? by eropple on Sunday November 15, 2015 @06:53PM (#10571806)
You misunderstand me. There is nothing in Go channels, syntactically or semantically, that is improved by being in the language itself, except insofar as the language does not provide meaningful and useful abstractions to its users to allow them to do it. I don't care why they say they did it, I care that it isn't very good and that I can't effectively replace it because the core developers don't give me the tools to do what is trivial in any other statically-typed language I see in common use. Channels and goroutines exist as core language features because the language is inexpressive because Go fundamentally does not trust end-use programmers to do smart things--so core developers had to do it instead.

"Misstep" was the kindest phrasing I had for the kind of trainwreckish design decisions and institutional reification of developer mediocrity that get you to what you're defending.

Your chosen tools have contempt for you, and it mystifies me as to why you would defend them for their failures.

Re:What will be the legacy of Go? by kasey_junk on Sunday November 15, 2015 @08:25AM (#10569538)
Scala, Java & C# are all languages I've used professionally that have concurrent queues built into the standard library.
Re:What will be the legacy of Go? by stingraycharles on Saturday November 14, 2015 @07:49PM (#10567994)
It would be quite unfair to have the "removal of the thread" be a legacy of Go, given that this is not something Go invented.
Re:What will be the legacy of Go? by sigzero on Saturday November 14, 2015 @07:51PM (#10567999)
Well, to be fair, Go doesn't bring anything "new" to the table either.
Re:What will be the legacy of Go? by eropple on Sunday November 15, 2015 @12:17PM (#10570207)
Precisely this.

While we're talking about what it popularizes, there's also the sense of epistemic closure that I've never seen to the extent that I do in the Go community. You're right in that it doesn't bring anything new to the table; that's its developers' intent, but its fans have tried to turn it into some kind of revelation. Which it's not, of course, it's Java 1.1 with a somewhat nicer syntax. And that's not a crime, it's not unforgivable--but it's also nothing special, and by god am I so very tired of its partisans holding it up as the best thing since sliced bread because they don't know what the rest of the world looks like.

(This expressly acknowledges the--rather few, IMO--Go fans who do understand the rest of the world and use it for their own reasons; I think they're hurting themselves, but I respect the choice.)

Re:What will be the legacy of Go? by aikah on Saturday November 14, 2015 @07:32PM (#10567934)
> The world of deployments e.g. build scripts, containers, extravagant tools are all unnecessary with Go.

I'm not arguing that Go makes deployment easier but it doesn't make all these things unnecessary ,as a server is only one component of an app among many others.

I'd like to see more languages supporting some sort of web-app packaging though( I know I can do something like this with python , i.e. bundle everything in a single executable). I think it is an elegant solution.

Re:What will be the legacy of Go? by 0942v8653 on Saturday November 14, 2015 @08:27PM (#10568118)
https://github.com/GeertJohan/go.rice/

lets you bundle resources into the executable. It's not part of the language but I don't think Python's is either (?)

Re:What will be the legacy of Go? by pjmlp on Sunday November 15, 2015 @03:28AM (#10568932)
Windows has been doing that since it exists.

Also UNIX systems like Aix have support for it.

Re:What will be the legacy of Go? by throwa990323249 on Saturday November 14, 2015 @08:01PM (#10568032)
>The language itself not much. It doesn't offer anything new that Java 1.0 with Quasar doesn't already have.

It offers lots of abstractions Java didn't/doesn't: Lots of concurrency features, Ad hoc interfaces, Closures, Stack resizing, Type switches, Multiple returned values, Slices.