From fc89e5ea115d6da2217b52a87ba8eb73c207e916 Mon Sep 17 00:00:00 2001 From: zinc Date: Thu, 15 Oct 2026 02:51:54 +0330 Subject: actor: a declared actor without its own drop gets one that awaits owed replies and closes the endpoint; the handler reaches the struct through endpoint.state so the struct isn't shared; spawn hint skips mailbox structs --- docs/design/destructors.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/design/destructors.md') diff --git a/docs/design/destructors.md b/docs/design/destructors.md index 7d0c950..c828cbd 100644 --- a/docs/design/destructors.md +++ b/docs/design/destructors.md @@ -180,4 +180,4 @@ untyped `rt.new(n)` blocks take a drop like any other value, so there is no sepa - o3: `rt.o3_enter`/`rt.o3_leave` around `o3 { }` blocks and calls from normal code into o3 functions; `gc` inside sets `gc_pending`, the outermost leave runs it. - compiler: `heap(e)`, the three drop forms (a closure there gets `this`), the struct `drop` method as type drop (`set_tdrop` after `new(T)` and `heap`), set-once and set-early on locals, temporaries held in a hidden slot until the statement ends with a hint, the actor `send` check, the o3 errors. - since: reassigning an `m` owner frees the old value with a hint (6.8.5; `reassign_free` in analyzer.zc, which frees without freevar's clearing store, since a captured local's slot holds its cell); `pop` on an array with a drop, or an array field of one, is refused (6.15.5; fields were already borrowed projections); the spawn hint on `x.spawn()` of a mailbox struct (`spawn_hint`); memreport's `(drop)` marker; `break`/`continue` out of an `o3 { }` block call `o3_leave` for each block they leave (`lpo3`, the depth each loop began at); an o3 receiver method called from normal code enters and leaves the region (`methcall`); a candidate that reaches itself in `gc_drops` (`F_CYCLE`, a cycle or a drop capturing its value) drops now, one per collection. -- not yet: first users (file descriptors in `std.Host`, processes in `actor.zc`). +- first users: `std.File` (`Host.open` returns a `File*.u` whose drop closes the fd; `writefile` is built on it), and every declared actor struct without its own `drop` gets a generated one that waits for the replies its receiver is owed and closes the endpoint (the generated handler reaches the struct through `endpoint.state` rather than capturing `this`, since a captured value is shared and a shared value's free is the collector's; the generated drop returns at once in a worker, whose snapshot owns nothing). the spawn hint skips mailbox structs. -- cgit v1.2.3