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".

  • $\begingroup$ If there is a connection, it would be via continuations. $\endgroup$ Nov 13, 2012 at 15:25
  • 3
    $\begingroup$ Which incidentally are not dual to ntinuations. $\endgroup$ Nov 13, 2012 at 15:26
  • $\begingroup$ “Regrettably, the world of computing seems better at coining new terms for old meanings (or without any meaning at all).” © Edsger W. Dijkstra, EWD854. $\endgroup$
    – beroal
    Nov 16, 2012 at 19:12
  • 1
    $\begingroup$ The prefix 'co' isn't always category theoretic. A coconut isn't equivalent to a nut. $\endgroup$
    – Vijay D
    Nov 25, 2012 at 22:43

1 Answer 1


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. ;-) )


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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