undefined assignment
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user