From b26ad08b39b8229dcea0bafc4a8ba4b0d7ad7154 Mon Sep 17 00:00:00 2001 From: nodist Date: Tue, 2 Jun 2026 16:26:09 -0400 Subject: reformat with sync and async calls --- docs/type_system/fn.md | 31 +++++++++++++++++++++++-------- docs/type_system/overload.md | 6 +++--- docs/type_system/task.md | 4 ++-- 3 files changed, 28 insertions(+), 13 deletions(-) (limited to 'docs/type_system') diff --git a/docs/type_system/fn.md b/docs/type_system/fn.md index 5a723f6..b004560 100644 --- a/docs/type_system/fn.md +++ b/docs/type_system/fn.md @@ -3,7 +3,12 @@ --- ```text -Fn_class `alias Enum[.unknown; .incomplete; .native; process; .generator; .iterator; .closure; .bound; .regex] +Fn_class `alias Enum[ + .unknown; .incomplete; .native + .task; process; .generator; .iterator; .closure; + .bound; + .regex +] Fn[Fn_class; RETURN_TYPE; Tuple[ARGS]; STATE; List] ``` @@ -22,6 +27,10 @@ A function with an incomplete type, type checking occurs at invocation Native function wrapper +## Task + +A queue-able function in a process or iterator + ## Process A list of tasks with state @@ -62,12 +71,12 @@ Return `Void` to stop iteration ```text fn : Fn[n] $ ( @ 1 < n {[x] `yield 2 * x; n +: 1 } ) -it : fn `call 10 +it : fn `sync 10 // invoking @ it {[v] `log v } // 2 4 6 8 10 12 14 16 18 20 // same as above @ { - # `call it { + # `sync it { .value {[v] `log v } .done { `break } } @@ -76,15 +85,21 @@ it : fn `call 10 # Calling -## \`fork +## \`async + +Asynchronous call ```text -task : `fork fn -value : `join task +task : `async fn +value : `wait task ``` -## \`call +## \`sync + +Synchronous call + +If the callee is a process, an inline wait with async is used ```text -fn `call args // `join fn `task args +fn `sync args // can be turned into `wait fn `async args ``` diff --git a/docs/type_system/overload.md b/docs/type_system/overload.md index 116ce0e..dff2327 100644 --- a/docs/type_system/overload.md +++ b/docs/type_system/overload.md @@ -13,7 +13,7 @@ Overload[FN; ...] ```text add : Overload[Fn[.native; I64; Tuple[I64.x; I64.y]; ...]; Fn[.native; F64; Tuple[F64.x; F64.y]; ...]; ...] -`log add `call (1; 2) // Valid calls first -`log add `call (1.1; 2.2) // Valid calls second -`log add `call (1; 2.2) // Invalid no signature match +`log add `sync (1; 2) // Valid calls first +`log add `sync (1.1; 2.2) // Valid calls second +`log add `sync (1; 2.2) // Invalid no signature match ``` diff --git a/docs/type_system/task.md b/docs/type_system/task.md index 0f3e575..06790d7 100644 --- a/docs/type_system/task.md +++ b/docs/type_system/task.md @@ -5,7 +5,7 @@ A segment of code assigned to a process, task code can be recursive ```text -Task[JOIN_TYPE; PROCESS; AST; IR; CODE] +Task[JOIN_TYPE; PROCESS] ``` -## \`join +## \`wait -- cgit v1.2.3