spec: accept RFC 0012 and integrate waits, channels, select and mutex

revision 2 per owner review: reserved-feature dependencies may change
until publication (general rule, DD-014); task.join.cancel returns the
handle on cancelled with loans still LOANED; channel.sender.dup from
ref<sender<T>> (MPSC, receiver_dup reserved); task.wait required by
every suspending operation, task.join included, only in modules
declaring cancellation; sent values and handles come back as block
parameters on closed/cancelled edges; explicit channel states

spec 04 §37-§41 and pointers in §11-§16, §35, §36; spec 05 §9, 07
§8.11, 07a, 08 §14, 11 §6-§7; features cancellation, channels, sync
published (implementation pending); rwlock, channel_transfer,
receiver_dup, guard_transfer reserved; effect task.wait; E4304, E4305;
Q-013 resolved; bundle +15.8 % tokens (recorded)
This commit is contained in:
dev committed 2026-10-04 16:27:38 +03:00
1 parent 4230c78dd1
commit b82bc35c5f
19 files changed
+387 -67

No files matched your search

+10
View File
@@ -259,6 +259,16 @@ Allowed only in functions that declare the effect `unsafe` or are `trusted` (`E6
Types `scope` and `task<T>` (linear, function-bound), instructions `task.scope.begin`, `task.spawn %s, @f(…)`, `task.join`, `task.cancel`, `task.cancelled`, `task.scope.end`; loans, `Send`/`Share` and the scheduler: spec 04 §33–§36.
## Features `cancellation`, `channels`, `sync`
`cancellation`: type `shield`, effect `task.wait`, instructions `task.check_cancel`, `task.join.cancel`, `task.shield.begin`, `task.shield.end`; the waiting-operation rule: spec 04 §37.
`channels`: types `sender<T>`, `receiver<T>`, instructions `channel.make`, `channel.sender.dup`, `channel.send`, `channel.recv`, `channel.close_sender`, `channel.close_receiver`, `select`: spec 04 §38–§39.
`sync`: types `mutex<T>`, `guard<T>`, instructions `mutex.make`, `mutex.take`, `mutex.lock`, `mutex.borrow`, `mutex.unlock`; the critical-section rule: spec 04 §40–§41.
Every terminator of these features follows spec 07 §8.2: each named target receives exactly the parameters its contract lists.
## Run result
`aji run` executes the function `@main`, whose parameters MUST all be capabilities, bound by name at instantiation (spec 05 §10.2); without the `capabilities` feature it takes no parameters. On return it reports `{"status":"returned","value":V}` where `V` renders the returned value as JSON: