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$– Dave ClarkeNov 13, 2012 at 15:25
-
3$\begingroup$ Which incidentally are not dual to ntinuations. $\endgroup$– Dave ClarkeNov 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$– beroalNov 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 DNov 25, 2012 at 22:43
1 Answer
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. ;-) )