summaryrefslogtreecommitdiff
path: root/docs/type_system/union.md
diff options
context:
space:
mode:
authornodist <kevin.comas.git@gmail.com>2026-05-16 16:12:28 -0400
committernodist <kevin.comas.git@gmail.com>2026-05-16 16:12:28 -0400
commitde1b4d5b6444417a163e90b032f487c91e62c8a4 (patch)
tree6020452cd6102949b33e9a100f99dc4b19be86e0 /docs/type_system/union.md
parentfdb84845b43d9fea2271671cb9732fb3b0515b7d (diff)
specify union classes
Diffstat (limited to 'docs/type_system/union.md')
-rw-r--r--docs/type_system/union.md24
1 files changed, 19 insertions, 5 deletions
diff --git a/docs/type_system/union.md b/docs/type_system/union.md
index f2c4ae0..0f8b65b 100644
--- a/docs/type_system/union.md
+++ b/docs/type_system/union.md
@@ -3,25 +3,39 @@
---
```text
-Union[TYPE.symbol; ...]
+Union_class `alias Enum[.container; .transient]
+
+Union[Union_class; TYPE.symbol; ...]
```
```text
-u : Union[I64.a; I64.b; I64.c] $ (.c : 5)
+u : Union[I64.a; I64.b; I64.c] $ (.c : 5) // defaults to Union[.container; ...]
# u {
.c { c ... }[c]
{ ... } // default
}
```
+
+# Transient Unions
+
+Can only be retuned from functions and operations. The inner value must be moved out
+
## Alias
```text
-Result[ANY] `alias Union[ANY.value; Error.error]
+Result[ANY] `alias Union[.transient; ANY.value; Error.error]
+
+Option[ANY] `alias Union[.transient; ANY.some; Void.none]
```
-## \`take
+## Default Operation
+
+When a transient union is assigned the first type specified is moved out.
+
+If the type is not the first specified a result with an error is returned to the parent function
```text
-value : .value `take 10 / var
+z : x / y // Result[Int[...]]
+z // is value if y is not zero
```