Bind typed source functions with exact effect contracts during deterministic specialization; retain nominal operation identity and ordinary AIR verification. Add spec/RFC/grammar, checked Quick Reference examples, source/AIR conformance, package/hosted CLI tests, scheduler/GC coverage and documentation budgets.
12 lines
523 B
Rust
12 lines
523 B
Rust
// expect: run
|
|
// result: 42
|
|
// phase: 6
|
|
// spec: docs/spec/15-source-language.md §18
|
|
// schedules: 12
|
|
module test.static_functions
|
|
fn read(value: ref<u64>) -> u64 effects [] { return *value; }
|
|
fn run<F: fn(ref<u64>) -> u64 effects []>() -> u64 effects [task.spawn, task.wait] {
|
|
var value: u64 = 42; var result: u64 = 0; { ref loan = value; scope s { let t = task.spawn(s, F, loan); result = task.join(move t); } } value = 0; return result;
|
|
}
|
|
fn main() -> u64 effects [task.spawn, task.wait] { return run::<fn read>(); }
|