5
$\begingroup$

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

$\endgroup$
  • $\begingroup$ If there is a connection, it would be via continuations. $\endgroup$ – Dave Clarke Nov 13 '12 at 15:25
  • 2
    $\begingroup$ Which incidentally are not dual to ntinuations. $\endgroup$ – Dave Clarke Nov 13 '12 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 '12 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 '12 at 22:43
10
$\begingroup$

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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