distinct type aliasing

This commit is contained in:
2026-06-23 12:29:21 +02:00
parent 6512ccd543
commit f16f352d1e
15 changed files with 525 additions and 58 deletions
+7 -2
View File
@@ -127,7 +127,12 @@
7. enums (native and c interop) (see below)
8. distinct types (see below)
8. distinct types (implemented; see below)
- nominal declarations preserve identity across packages and reuse the backing runtime representation
- construction uses `Type(value)` with exactly one value of the exact backing type
- no implicit conversion to or from the backing type
- backing-type operators and reverse explicit conversions remain deferred
- concrete runtime backing types are supported; unresolved, `int`, `void`, function, and opaque backings are rejected
## A word on multi-unwrap
@@ -204,7 +209,7 @@ Distinct types are considered distinct from their backing type. They do not impl
UserID :: distinct u32
# instantiate distinct type
my_id UserId :: UserID(42) # value must be of to backing type
my_id UserID :: UserID(42) # value must have the exact backing type
```
# A word on enums