Commit b907681
docs(skill): clarify that handler thread-safety is compiler-enforced
The "anti-pattern" framing in examples.md was misleading -- it implied
the RefCell example might compile but produce bugs at runtime. In
reality, SessionHandler's `Send + Sync + 'static` trait bound rejects
any handler whose state contains a non-Sync type (RefCell, Cell, Rc),
so the example fails at the impl site, not at use.
Reframe as "Won't compile", show the actual trait-bound error inline,
and add a one-paragraph note explaining the compiler-level enforcement
so a reader doesn't have to mentally trace
`spawn -> Send + Sync -> RefCell !Sync`. Addresses stephentoub's
review feedback that the prior framing read as "we've buried some
unsafe usage."
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent c8fe373 commit b907681
1 file changed
Lines changed: 17 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
89 | 93 | | |
90 | 94 | | |
91 | 95 | | |
92 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
93 | 103 | | |
94 | 104 | | |
95 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
96 | 110 | | |
97 | 111 | | |
98 | 112 | | |
99 | 113 | | |
100 | | - | |
| 114 | + | |
101 | 115 | | |
102 | 116 | | |
103 | 117 | | |
| |||
0 commit comments