You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/d4058-case-for-coros.md
+53-1Lines changed: 53 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -396,7 +396,59 @@ A: Section 7 concedes this. The cost is real. The paper does not argue the cost
396
396
397
397
---
398
398
399
-
## 9. Conclusion
399
+
## 9. The Design Fork
400
+
401
+
```cpp
402
+
// Awaitable // Sender
403
+
void await_suspend( template<class Receiver>
404
+
coroutine_handle<> h); struct read_operation {
405
+
// caller erased Receiver rcvr_;
406
+
// caller stamped in
407
+
};
408
+
```
409
+
410
+
`coroutine_handle<>` erases the caller. `connect(sender, receiver)` stamps the caller into the operation state. Every row below is a downstream consequence of this choice.
| Single-parameter task type (no fragmentation) || Yes ||
439
+
| Cross-library interop without bridges || Yes ||
440
+
| Production deployment at scale | Yes | Yes ||
441
+
|**Costs**||||
442
+
| Heap allocation per coroutine frame || Yes ||
443
+
| Opaque resume (optimization barrier) || Yes ||
444
+
| Reference lifetime hazard in coroutine frames || Yes ||
445
+
| Complexity at the I/O call site | Yes |||
446
+
447
+
The two property sets are mutually exclusive consequences of the design fork. The first five rows follow from stamping the receiver into the operation state. The next six rows follow from erasing the caller behind `coroutine_handle<>`. Neither model can acquire the other's properties without surrendering its own. The Need column is left for the reader.
448
+
449
+
---
450
+
451
+
## 10. Conclusion
400
452
401
453
The sender model makes design choices that give the optimizer full pipeline visibility, enable zero-allocation composition, and provide type-level completion contracts. These choices are correct for GPU dispatch, heterogeneous execution, and compile-time work graphs - the domains where `std::execution` is deployed at scale.
0 commit comments