Theoretical Computer Science Stack Exchange is a question and answer site for theoretical computer scientists and researchers in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The name coroutine suggests that in some sense they should be dual to (sub)routines. Is there a real mathematical duality? I'm hoping for something like "in category theory subroutines are X and coroutines are Y, where X is dual to Y".

share|cite|improve this question
If there is a connection, it would be via continuations. – Dave Clarke Nov 13 '12 at 15:25
Which incidentally are not dual to ntinuations. – Dave Clarke Nov 13 '12 at 15:26
“Regrettably, the world of computing seems better at coining new terms for old meanings (or without any meaning at all).” © Edsger W. Dijkstra, EWD854. – beroal Nov 16 '12 at 19:12
The prefix 'co' isn't always category theoretic. A coconut isn't equivalent to a nut. – Vijay D Nov 25 '12 at 22:43
up vote 10 down vote accepted

I think this a misanalysis of the "co" prefix in this case.

"Coroutine" is "co" in the sense of "co-worker"; something that works together with another.

The term precedes by a long way the gross overuse for programming concepts of the prefix "co" in the Category Theoretic sense of a dual of another concept.

(Yes, there is editorial content there. ;-) )

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.