Commit 97aa7c3b
97aa7c3b7787Merged
Ori Pekelman <[email protected]> · 5 months ago · 1 file · ~1 modified
Description
docs: update RACTOR-RFC for Milestone 3 (spawn args + Hash codec)
Reflect what now ships: the message codec spans immediates/Symbol/String/ Array/Hash, Ractor.new(args){|p|} spawn arguments are supported, and the path-forward narrows to user objects, cvar/gvar initializer replay, and a Ractor::Port surface.
Co-Authored-By: Claude Opus 4.8 (1M context) [email protected]
Details
- Commit
- 97aa7c3b7787
- Parent
- a4de7cda3736
docs/RACTOR-RFC.mdmodifiedView file
@@ -1,7 +1,8 @@
11
# RFC: A Minimal Ractor for Spinel22
3-
Status: **experimental / Milestone 2** (working; ported to the C compiler in4-
`src/`). This document is both the design3+
Status: **experimental / Milestone 3** (working; ported to the C compiler in4+
`src/`; message codec spans immediates/Symbol/String/Array/Hash; Ractor.new5+
spawn arguments). This document is both the design56
rationale and the record of what currently ships. It proposes whether to67
graduate to a full implementation (see *Path forward*).78
@@ -119,13 +120,15 @@
119120
120121
## Deliberate divergences (where "minimal" buys simplicity)121122
122-
1. **Value codec covers immediates, Symbol, String, and Arrays** (poly + typed123-
int/float/string), deep-copied through a heap-neutral malloc'd blob124-
(`sp_ractor_serialize`/`_deserialize`, installed via a hook because the125-
rebuild allocators are static to the generated TU). Hashes, plain objects,126-
Procs, Fibers, and IO raise `Ractor::Error` at the boundary — extending the127-
codec to those (and to nested objects) is the main follow-up. Symbols travel128-
by name and are re-interned in the receiver's per-Ractor table.123+
1. **Value codec covers immediates, Symbol, String, Arrays, and Hashes** (poly124+
+ typed variants), deep-copied recursively through a heap-neutral malloc'd125+
blob (`sp_ractor_serialize`/`_deserialize`, installed via a hook because the126+
rebuild allocators are static to the generated TU). Plain objects, Procs,127+
Fibers, and IO raise `Ractor::Error` at the boundary — extending the codec to128+
user objects is the main follow-up. Symbols travel by name and are129+
re-interned in the receiver's per-Ractor table; hashes are normalised to a130+
poly hash on rebuild. The same codec seeds `Ractor.new(args) { |params| }`131+
spawn arguments.129132
2. **FIFO mailbox / outgoing queue** (mutex + condvar, grows on demand), so a130133
Ractor may `receive` several messages and a sender need not block per slot.131134
3. **`@@cvars` / `$globals` are `__thread`** → isolated per Ractor, rather than@@ -162,9 +165,11 @@
162165
163166
## Path forward (if this graduates)164167
165-
In rough dependency order: extend `sp_deep_copy` to strings → arrays → hashes →166-
objects (symbols travel by name, re-interned on receive); make the mailbox167-
unbounded; thread-local-ize `@@cvars`/`$globals` with a class-body initializer168-
replay on the child; add spawn args and shareable-by-value capture; and a169-
`Ractor::Port`-style multi-consumer surface. None of these change the core170-
partition above — they extend it.168+
Done since the original RFC: the codec now spans strings → symbols → arrays →169+
hashes (M2/M3b), the mailbox is an unbounded FIFO, and `Ractor.new(args){|p|}`170+
spawn arguments are deep-copied in (M3a). Remaining, in rough dependency order:171+
extend the codec to **user objects / structs** (the last big container gap);172+
replay class-body `@@cvar`/`$gvar` initializers in a child (they are `__thread`,173+
hence empty in a child today); shareable-by-value frozen captures; and a174+
`Ractor::Port`-style multi-consumer surface. None change the core partition175+
above — they extend it.