<p>I think this a misanalysis of the "co" prefix in this case.</p>

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

<p>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.</p>

<p>(Yes, there is editorial content there. ;-) ) </p>

CC BY-SA 3.0
2012-11-12T18:43:51.367Z
2012-11-12T18:43:51.367Z
Marc Hamann
<p>The name <a href="https://en.wikipedia.org/wiki/Coroutine" rel="nofollow"><em>coroutine</em></a> 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".</p>

CC BY-SA 3.0
2012-11-13T15:25:42.890Z
If there is a connection, it would be via continuations.
Dave Clarke
CC BY-SA 3.0
2012-11-13T15:26:02.937Z
Which incidentally are not dual to ntinuations.
Dave Clarke
CC BY-SA 3.0
2012-11-16T19:12:55.760Z
“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
CC BY-SA 3.0
2012-11-25T22:43:57.803Z
The prefix 'co' isn't always category theoretic. A coconut isn't equivalent to a nut.
Vijay D
<pl.programming-languages><ct.category-theory>
In what sense are coroutines dual to (sub)routines?
Petr
# In what sense are coroutines dual to (sub)routines?

(Asked by: username_0 on 2012-11-12)

The name [*coroutine*](https://en.wikipedia.org/wiki/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".

**Tags:** pl.programming-languages, ct.category-theory

> **Comments:**
> **username_1**: If there is a connection, it would be via continuations.  
> **username_1**: Which incidentally are not dual to ntinuations.  
> **username_2**: “Regrettably, the world of computing seems better at coining new terms for old meanings (or without any meaning at all).” © Edsger W. Dijkstra, EWD854.  
> **username_3**: The prefix 'co' isn't always category theoretic. A coconut isn't equivalent to a nut.  

---

## 1 answers

### Answer by username_4 on 2012-11-12. Score: 12 | Accepted 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. ;-) )


---

