Surfaced by
Building lib/supervise.eigs (#409). Filed per the forcing-function model — surfacing the gap rather than working around it.
The gap
A cooperative task (#408) has no way to obtain its own task id. task_spawn returns the child's id to the parent, but a task cannot discover its own — there is no task_self. So a worker cannot hand its supervisor a return address, which is exactly what the BEAM-style link pattern needs (a worker delivers its exit/throw as a message to the supervisor's mailbox).
lib/supervise.eigs works today without it: cooperative tasks share the module-global heap on one thread, so the supervisor reads workers' progress and completion out of shared state rather than via messages. But the message-link variant the #409 issue sketches ("task exit/throw delivered as an ordinary message") is not expressible — a worker has no id to send to until something tells it, and nothing can tell it its supervisor's id without the supervisor knowing its own id to pass down.
Proposal
task_self of null → the current task's id (the same integer space task_spawn returns; the main task gets a stable id too). Pure and deterministic under the seeded scheduler — it reads the current task id, not a nondeterminism source, so no tape participation is needed. The extend-vm checklist applies (new builtin registration, docs, the discoverability gate, SPEC "Cooperative tasks").
Payoff
Unblocks message-link supervision (lib/supervise.eigs could offer a link-based mode alongside the shared-state one), and the general "reply to whoever spawned/messaged me" pattern that mailboxes otherwise can't express.
Surfaced by
Building
lib/supervise.eigs(#409). Filed per the forcing-function model — surfacing the gap rather than working around it.The gap
A cooperative task (#408) has no way to obtain its own task id.
task_spawnreturns the child's id to the parent, but a task cannot discover its own — there is notask_self. So a worker cannot hand its supervisor a return address, which is exactly what the BEAM-style link pattern needs (a worker delivers its exit/throw as a message to the supervisor's mailbox).lib/supervise.eigsworks today without it: cooperative tasks share the module-global heap on one thread, so the supervisor reads workers' progress and completion out of shared state rather than via messages. But the message-link variant the #409 issue sketches ("task exit/throw delivered as an ordinary message") is not expressible — a worker has no id to send to until something tells it, and nothing can tell it its supervisor's id without the supervisor knowing its own id to pass down.Proposal
task_self of null→ the current task's id (the same integer spacetask_spawnreturns; the main task gets a stable id too). Pure and deterministic under the seeded scheduler — it reads the current task id, not a nondeterminism source, so no tape participation is needed. The extend-vm checklist applies (new builtin registration, docs, the discoverability gate, SPEC "Cooperative tasks").Payoff
Unblocks message-link supervision (
lib/supervise.eigscould offer a link-based mode alongside the shared-state one), and the general "reply to whoever spawned/messaged me" pattern that mailboxes otherwise can't express.