News for hackers. Stuff that matters.
Re:Celery, non-blocking code and quest against coroutines by omni on Thursday June 09, 2016 @09:35AM (#11869255)
> In the last 10 years I've never met a case where someone pointed out that "this code needs to be concurrent, but single threaded".

I wish I could have slept through the circa 2012 Node.js hype cycle like this person clearly did.

Re:Celery, non-blocking code and quest against coroutines by omni on Thursday June 09, 2016 @09:39AM (#11869275)
To follow up on my own snark:

> Do people use coroutines? Yes, but not in production code.

Now I'm wondering if I'm the one who's confused. Either the author has also never heard of Go or goroutines don't meet his/her definition of coroutines.

Re:Celery, non-blocking code and quest against coroutines by weberc2 on Thursday June 09, 2016 @09:46AM (#11869320)
I'm guessing it's the latter, and perhaps not without cause. Traditionally, coroutines require the programmer to explicitly yield. With Go, you don't have to think about that much; you can pretty much treat them as lightweight threads and trust the scheduler to do the right thing. Goroutines aren't pre-empted, but the yield points aren't explicit (though they are well defined and thus easy to reason about).
Re:Celery, non-blocking code and quest against coroutines by jerf on Thursday June 09, 2016 @10:15AM (#11869495)
"Traditionally, coroutines require the programmer to explicitly yield."

When terms move from academia into common usage, they inevitably blur. Academia had a specific definition of coroutine that includes that. Programmers now use "coroutines" in a way that I have a hard time distinguishing from "threads", Pythonic "generators", and in the worst cases "something vaguely concurrent". Any given author may have a clear idea of what they mean (and in particular, I'm not making any specific accusations about the author of this piece) but the term is rapidly approaching uselessness in the general programming community.

Re:Celery, non-blocking code and quest against coroutines by jacquesm on Thursday June 09, 2016 @10:47AM (#11869711)
Goroutines are coroutines within the context of a single thread only, but there may be more of those and a goroutine is as far as I know not always executed by the same thread on the next tick. It's just a way to conserve resources, if goroutines would be threads they'd use a lot more stack space and other precious bits.
Re:Celery, non-blocking code and quest against coroutines by mdomans on Thursday June 09, 2016 @09:42AM (#11869289)
I know of goroutines and comparing Python's coroutines to goroutines is like saying that Porsche and Tata car's are same, since both have 4 wheels.
Re:Celery, non-blocking code and quest against coroutines by omni on Thursday June 09, 2016 @09:44AM (#11869302)
Fair enough, I thought you were speaking more generally since the next sentence was:

> I may be opinionated, but I've done concurrency in many languages and never ever have I seen anything less readable than coroutines.

Re:Celery, non-blocking code and quest against coroutines by mpeg on Thursday June 09, 2016 @10:36AM (#11869621)
Also that sentence makes no sense, I usually care more about async I/O than I care about parallelism.

For instance, I can make API requests at a higher rate than most APIs will let me from a single threaded async client.

Re:Celery, non-blocking code and quest against coroutines by mdomans on Thursday June 09, 2016 @09:42AM (#11869291)
I haven't slept through 2012 - I just try to not acknowledge it :)