undefined assignment

This commit is contained in:
2026-06-25 20:37:20 +02:00
parent e0b6f6049c
commit ca6cc89da0
10 changed files with 489 additions and 47 deletions
+17
View File
@@ -166,6 +166,23 @@
no hand-writable spelling and are emitted as `# unsupported in bindings:` comments
(functions that reference an un-spellable union therefore keep a dangling reference)
12. `undefined` as inspired by zig (implemented):
- allow mutable local declarations with `undefined`
- undefined values are assigned a poison value (0xaa...)
- allows for something like:
```
a int = undefined
if (condition) {
a = 42
} else {
a = -2
}
```
- disallow: `b :: undefined` since assigning undefined to something that can't change defeats the purpose
- disallow assigning `undefined` after declaration; use optionals and `none` for values that intentionally move back to an empty state
13. broaden type inference from surrounding context
## A word on multi-unwrap
Unwrap multiple optionals with `and`. This **short-circuits**: if the first optional is none, subsequent expressions are not evaluated.