diff options
| author | nodist <kevin.comas.git@gmail.com> | 2026-06-09 10:07:44 -0400 |
|---|---|---|
| committer | nodist <kevin.comas.git@gmail.com> | 2026-06-09 10:07:44 -0400 |
| commit | 4da9de3213a28c7e17945168acdb06308bb41df8 (patch) | |
| tree | 6bc6a3ff8653eb7bfe6591c36a7ab9b491649b9d /docs | |
| parent | faac96fff84c45acf20af0515e8fd43af32fdaca (diff) | |
use group for tuple and table
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/application/gc.md | 10 | ||||
| -rw-r--r-- | docs/application/group.md (renamed from docs/application/tuple.md) | 8 | ||||
| -rw-r--r-- | docs/application/index.md | 2 | ||||
| -rw-r--r-- | docs/application/namespace.md | 4 | ||||
| -rw-r--r-- | docs/application/thread.md | 4 | ||||
| -rw-r--r-- | docs/type_system/enum.md | 6 | ||||
| -rw-r--r-- | docs/type_system/fn.md | 2 | ||||
| -rw-r--r-- | docs/type_system/group.md | 36 | ||||
| -rw-r--r-- | docs/type_system/index.md | 8 | ||||
| -rw-r--r-- | docs/type_system/overload.md | 2 | ||||
| -rw-r--r-- | docs/type_system/tuple.md | 25 | ||||
| -rw-r--r-- | docs/type_system/union.md | 12 |
12 files changed, 73 insertions, 46 deletions
diff --git a/docs/application/gc.md b/docs/application/gc.md index 9364e12..ff538ee 100644 --- a/docs/application/gc.md +++ b/docs/application/gc.md @@ -15,16 +15,16 @@ typedef struct _kpl_gc { pthread_mutex_t mutex; } kpl_gc; -static _Atomic size_t marked_threads; +static _Atomic size_t gc_threads; -static kpl_gc *old_gc_head, *gc_head, *gc_tail; +static kpl_gc *old_gc_head, *gc_head; ``` ## Counting `ref_count` starts at 1 -Each assign increments the reference count, each time it goes out of scope the reference count is decreased +Each assign increments the `ref_count`, each time it goes out of scope the `ref_count` is decreased When `ref_count` hits 0, data is freed @@ -33,6 +33,6 @@ When `ref_count` hits 0, data is freed 1. Once triggered add a init task to the async queue 2. This task moves the `gc_head` to the `old_gc_head` and sets the `gc_wait` to off for each thread 3. Each thread will run down its queue queue marking found gc objects -3. Once all have run and `marked_threads == available_threads` add a mark and sweep task to the async queue +3. Once all have run and `gc_threads == available_threads` add a mark and sweep task to the async queue 4. Async task goes down async queue and does final mark, then a sweep on the `old_gc_head` is done -5. What remains on the `old_gc_head` is added to the gc tail +5. What remains on the `old_gc_head` is added to `gc_head` diff --git a/docs/application/tuple.md b/docs/application/group.md index e0e926c..2d5ed4b 100644 --- a/docs/application/tuple.md +++ b/docs/application/group.md @@ -1,13 +1,13 @@ -# Tuple +# Group --- ## Object Definitions ```c -typedef struct _kpl_tuple { - POOL_HEADER(_kpl_tuple); +typedef struct _kpl_group { + POOL_HEADER(_kpl_group); uint32_t item_length; kpl_class items[]; -} kpl_tuple; +} kpl_group; ``` diff --git a/docs/application/index.md b/docs/application/index.md index f4a013b..9f316bc 100644 --- a/docs/application/index.md +++ b/docs/application/index.md @@ -16,7 +16,7 @@ * ##### [Thread](./thread.md) * ##### [Io](./io.md) * ##### [Gc](./gc.md) -* ##### [Tuple](./tuple.md) +* ##### [Group](./group.md) * ##### [Buffer](./buffer.md) * ##### [Map](./map.md) * ##### [Queue](./queue.md) diff --git a/docs/application/namespace.md b/docs/application/namespace.md index 6891376..41d9ee5 100644 --- a/docs/application/namespace.md +++ b/docs/application/namespace.md @@ -7,11 +7,13 @@ ```c typedef struct _kpl_export { POOL_HEADER(_kpl_export); - _Atomic int32_t ref_count; + kpl_type_ptr type; kpl_buffer *name; kpl_class *class; } kpl_export; +static kpl_export *export_head; + typedef struct _kpl_native_namespace { POOL_HEADER(_kpl_native_namespace); kpl_buffer *name; diff --git a/docs/application/thread.md b/docs/application/thread.md index ba67a7e..7e13d71 100644 --- a/docs/application/thread.md +++ b/docs/application/thread.md @@ -14,7 +14,7 @@ typedef struct _kpl_task { _Atomic bool join_ready; uint16_t worker_id; kpl_task_fn *fn; - kpl_tuple *state; + kpl_group *state; kpl_interface *ret_interface; kpl_result ret; } kpl_task; @@ -45,7 +45,7 @@ static kpl_thread threads[KPL_MAX_THREADS]; ```text 0 -> length native : arguments -process : arguments, locals +process : arguments, locals, parent closure : arguments, locals, closure function iterator : arguments, locals, iterator functions, iterator function index ``` diff --git a/docs/type_system/enum.md b/docs/type_system/enum.md index 4abcdb2..4762389 100644 --- a/docs/type_system/enum.md +++ b/docs/type_system/enum.md @@ -5,9 +5,9 @@ A symbol associated with a type ```text -Enum[.name; ...] // Resoves to Enum[Void; ...] +Enum[Collection[.symbol]] // Resoves to Enum[Void; ...] -Enum[TYPE; .name; ...] +Enum[TYPE; Collection[.symbol]] -Enum[TYPE; .name : VALUE; ...] +Enum[TYPE; Collection[.symbol : VALUE]] ``` diff --git a/docs/type_system/fn.md b/docs/type_system/fn.md index c5c1ba7..1bf88c5 100644 --- a/docs/type_system/fn.md +++ b/docs/type_system/fn.md @@ -10,7 +10,7 @@ Fn_class `alias Enum[ .regex ] -Fn[Fn_class; RETURN_TYPE; List[ARGS]; STATE; List] +Fn[Fn_class; RETURN_TYPE; Collection[ARGS]; STATE; List] Fn[Fn_class; RETURN_TYPE; ARGS...] Fn[RETURN_TYPE; ARGS...] diff --git a/docs/type_system/group.md b/docs/type_system/group.md new file mode 100644 index 0000000..45e7dcb --- /dev/null +++ b/docs/type_system/group.md @@ -0,0 +1,36 @@ +# Group + +--- + +A sequence of different types accessed by index or a symbol mapped to an index + +```text +Group_access `alias Enum[.index; .symbol] +Group[Tuple_access; Collection[TYPE.SYMBOL]] +``` + +# Alias + +```text +Tuple[Collection[TYPE.SYMBOL]] `alias Group[.index; Collection[TYPE.SYMBOL]] + +Table[Collection[TYPE.SYMBOL]] `alias Group[.symbol; Collection[TYPE.SYMBOL]] +``` + +# Operators + +## ``get` + +## ``set` + +```text +Result[Void] : target `set (KEY; VALUE) + +items : Tuple $ (1; 2; 3) +items `set (0; 4) +`log items // Tuple[I64; I64; I64] $ (4; 2; 3) +``` + +# Destructuring + +# Mutating diff --git a/docs/type_system/index.md b/docs/type_system/index.md index eb788d4..ece02b1 100644 --- a/docs/type_system/index.md +++ b/docs/type_system/index.md @@ -26,6 +26,12 @@ A template by name only expands to all inner fields as `Any` Generic for alias and unique types, type is replaced with type passed +## Collection[TYPE] + +A list of types with shape of TYPE, only can have one collection per type + +This represents a spread after a type field + ### Void Denotes that a field that does not resolve to anything @@ -38,7 +44,7 @@ Denotes that a field that does not resolve to anything ## Container Templates -* #### [Tuple](./tuple.md) +* #### [Group](./group.md) * #### [Buffer](./buffer.md) diff --git a/docs/type_system/overload.md b/docs/type_system/overload.md index dff2327..11bf21d 100644 --- a/docs/type_system/overload.md +++ b/docs/type_system/overload.md @@ -5,7 +5,7 @@ List of complete functions, selected by signature ```text -Overload[FN; ...] +Overload[Collection[FNS]] ``` ## Example diff --git a/docs/type_system/tuple.md b/docs/type_system/tuple.md deleted file mode 100644 index fc1cdcb..0000000 --- a/docs/type_system/tuple.md +++ /dev/null @@ -1,25 +0,0 @@ -# Tuple - ---- - -A sequence of different types accessed by index or a symbol mapped to an index - -```text -Tuple[TYPE; TYPE.SYMBOL; ...] -``` - -# Operators - -## ``get` - -## ``set` - -```text -Result[Void] : target `set (KEY; VALUE) - -items : Tuple(1; 2; 3) -items `set (0; 4) -`log items // Tuple[I64; I64; I64] $ (4; 2; 3) -``` - -# Mutating diff --git a/docs/type_system/union.md b/docs/type_system/union.md index 2c4be2d..79c4987 100644 --- a/docs/type_system/union.md +++ b/docs/type_system/union.md @@ -5,11 +5,19 @@ ```text Union_class `alias Enum[.container; .transient] -Union[Union_class; TYPE.symbol; ...] +Union[Union_class; Collection[TYPE.SYMBOL]] ``` +# Alias + +```text +Tag[Collection[TYPE.SYMBOL]] `alias Union[.container; Collection[TYPE.SYMBOL]] +``` + +## Tag Example + ```text -u : Union[I64.a; I64.b; I64.c] $ (.c : 5) // defaults to Union[.container; ...] +u : Tag[I64.a; I64.b; I64.c] $ (.c : 5) # u { .c {[c] c ... } |
