News for hackers. Stuff that matters.
Re:Seven years of Go by weberc2 on Thursday November 10, 2016 @12:55PM (#12922584)
Efficient concurrent programming. I'm not aware of any cross-platform C/C++ or Python libraries that give you async I/O + multi-threaded coroutines. Such a library exists for the Java ecosystem (quasar), but IIRC, it's enabled by clever bytecode tricks, so it's not built with vanilla Java. Further, you still have to take care not to use any libraries that are incompatible with this concurrency model (e.g., anything that does sync I/O).
Re:Seven years of Go by wyager on Thursday November 10, 2016 @01:37PM (#12922945)
Precisely as I said, "The only major benefits over, say, C++ or Java (which I don't think are very impressive languages) are a few convenient threading primitives"

99% of projects don't need green threads. But for those that do, I'd much rather use a language better suited to the purpose, like Haskell or Erlang. This isn't a very convincing argument for Go.

Re:Seven years of Go by Skinney on Thursday November 10, 2016 @02:04PM (#12923194)
Erlang isn't necessarily better than Go in this regard. Since Erlang is interpreted and everything has to copied between processes, Go is bound to be faster than Erlang, especially when it comes to parallelism. Go is also statically typed, which in my experience makes it easier to avoid bugs in large teams.

Erlang, however, is much better at distributed concurrency. There are few who suits this use case better.

As in all cases. Use the best tool for the job.

Re:Seven years of Go by ramchip on Thursday November 10, 2016 @02:25PM (#12923386)
Erlang is actually compiled, and binaries above a certain size are reference-counted rather than copied between processes. It still makes various compromises like using bignums and doing preemptive scheduling which make it slower in general.
Re:Seven years of Go by Skinney on Thursday November 10, 2016 @05:28PM (#12925113)
It's compiled to erlang bytecode, yes, but not to machine code. You do have the option of doing that, but I do believe you miss out on live updates? Not sure.

Erlang is great though, especially Elixir, but for some use cases Go is better.

Re:Seven years of Go by wyager on Thursday November 10, 2016 @02:57PM (#12923694)
If the first paragraph is the extent of your concerns with Erlang (which are reasonable), they are more than addressed by Haskell. Compiled and very statically typed.
Re:Seven years of Go by Skinney on Thursday November 10, 2016 @05:30PM (#12925130)
Yeah, but it's more difficult to teach others Haskell (what's a monad?) than Go. I know all three languages, I mostly prefer Go for backend work because it's easier for others to join in on.

Point is that they all have their strengths, but one is not necessarily better than the other. As with all things digital, it depends.

Re:Seven years of Go by weberc2 on Thursday November 10, 2016 @03:40PM (#12924115)
> Precisely as I said, "The only major benefits over, say, C++ or Java (which I don't think are very impressive languages) are a few convenient threading primitives"

I commented before your edit. The question I responded to was something like "What can you do in Go that you can't do in C++ or Java?"

> 99% of projects don't need green threads.

Perhaps not need, but many of those projects are paying a large opportunity cost in today's no-free-lunch, multicore, I/O-bound world.

> But for those that do, I'd much rather use a language better suited to the purpose, like Haskell or Erlang.

I dispute that Haskell or Erlang are better suited for the purpose. And good luck finding Haskell and Erlang developers.

> This isn't a very convincing argument for Go.

I disagree.

Re:Seven years of Go by wtetzner on Thursday November 10, 2016 @03:51PM (#12924221)
> And good luck finding Haskell and Erlang developers.

Unless you need a massive number of developers, or you're located out in the middle of nowhere, it really shouldn't be too difficult.

Re:Seven years of Go by weberc2 on Thursday November 10, 2016 @04:22PM (#12924496)
I disagree.
Re:Seven years of Go by wtetzner on Thursday November 10, 2016 @05:37PM (#12925193)
Have you tried hiring Erlang or Haskell developers? It's not like they don't exist. In fact, there are likely many developers that would love to take an Erlang or Haskell job, but there aren't that many opportunities.
Re:Seven years of Go by weberc2 on Thursday November 10, 2016 @06:12PM (#12925511)
I don't dispute that they exist, I dispute the economics of finding them compared to finding or training new Go developers. Frankly, no one is going to replace their entire team and start a hiring campaign because Haskell or Erlang (arguably) make concurrency slightly easier than Go.
Re:Seven years of Go by di4na on Thursday November 10, 2016 @06:48PM (#12925864)
You would be surprised by the result. Economically it make sense. And i would argue that production ready Elixir/erlang is easier to teach than production ready Go.
Re:Seven years of Go by weberc2 on Friday November 11, 2016 @10:05AM (#12931219)
Still, I'm fairly risk averse. I'll wait for the inevitable explosion of Erlang/etc shops to take off before I jump on board.
Re:Seven years of Go by di4na on Monday November 14, 2016 @04:25AM (#12948556)
It happened. But well. Do as you want. It is your project :)
Re:Seven years of Go by pjmlp on Thursday November 10, 2016 @01:07PM (#12922684)
C++17 gives you async/await, coroutines and parallel algorithms.
Re:Seven years of Go by weberc2 on Thursday November 10, 2016 @03:30PM (#12924026)
Right, but this is still a far cry from Go's runtime/scheduler. In particular, the Go runtime completely handles threading and async I/O for me. I'm not sure what C++17 coroutines look like, but I don't even have to explicitly yield (which is the case in other C++ coroutine libraries).
Re:Seven years of Go by pjmlp on Thursday November 10, 2016 @04:47PM (#12924730)
Just like any other async/await model.

Also you don't need explicit yield on task runtimes like HPX.

Re:Seven years of Go by weberc2 on Thursday November 10, 2016 @04:57PM (#12924830)
> Just like any other async/await model.

I don't see how Go bears any resemblance to an async/await model. Did I misinterpret your statement?

> Also you don't need explicit yield on task runtimes like HPX.

I don't dispute that it's hypothetically possible to bolt enough things onto C++ to make it behave like Go, but I seriously doubt it's a viable solution. I would sincerely love to know if anyone has done all of this and is using it in production.

Re:Seven years of Go by pjmlp on Thursday November 10, 2016 @05:48PM (#12925297)
Async/await model is nothing more than a state machine over coroutine.

Goroutines are coroutines.

On the async/await model there are two approaches.

1 - The compiler takes care of the scheduling of the coroutines among the threads on the task pool, like C# 5.0 introduced.

2 - The compiler maps async/await into intrisics that know magic functions on the handles that represent tasks managed by the thread pool. This is called generalized async/await and is how C++17 will do it, and also how the C# model will evolve on C# 7.0

So while one must restrict ourselves with the co-routine scheduler provided by the Go runtime and to the yield points managed by it, with generalized async/await it is possible to have control how the scheduling actually takes place among co-routines.

Granted Go's model is easier to understand and might be enough for many people, but it isn't a solution for all types of concurrency problems.

Re:Seven years of Go by weberc2 on Thursday November 10, 2016 @06:07PM (#12925454)
> Goroutines are coroutines.

Traditionally, "coroutine" has been used to refer to a userspace concurrency unit that is not multiplexed and which requires explicit yielding. Mostly I'm grumpy about broadening a previously precise definition.

> So while one must restrict ourselves with the co-routine scheduler provided by the Go runtime and to the yield points managed by it, with generalized async/await it is possible to have control how the scheduling actually takes place among co-routines. Granted Go's model is easier to understand and might be enough for many people, but it isn't a solution for all types of concurrency problems.

Not having to control your own scheduling is the selling point of Go's concurrency model. Besides, Go does offer (at least some) control over scheduling via the runtime library. I've never had to use this in practice, and I can't imagine a scenario that would require nuanced control. I don't think async/await are the worst things, but I still prefer Go's runtime at least for the problems I have to solve.

Re:Seven years of Go by pjmlp on Friday November 11, 2016 @01:43AM (#12928517)
So what would you call coroutines that multiplex at API calls like NT fibers, or many green threads libraries.

Or for that matter, coroutines on Active Oberon, which are just multiplexed as in Go.

Re:Seven years of Go by weberc2 on Friday November 11, 2016 @10:02AM (#12931180)
I would call them fibers and green threads, respectively. No idea about Active Oberon.
Re:Seven years of Go by notduncansmith on Thursday November 10, 2016 @04:17PM (#12924445)
What about http://libmill.org ? There are also numerous other programming environments with similar constructs.
Re:Seven years of Go by weberc2 on Thursday November 10, 2016 @04:19PM (#12924467)
Not cross platform last I checked.
Re:Seven years of Go by notduncansmith on Thursday November 10, 2016 @07:54PM (#12926368)
I guess no Windows support could be a dealbreaker, but it's definitely "cross-platform" in several senses.
Re:Seven years of Go by weberc2 on Friday November 11, 2016 @10:04AM (#12931201)
That isn't cross-platform in the senses I care about. I'm sure libmill is great and I wish it the best.