diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2022-12-06 17:19:12 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-06 10:19:12 +0100 |
commit | b2c70190061233f2aaaaacdfb36f8f5181c1f514 (patch) | |
tree | b77672304b9dc444b98954bff404a0cd9b9ccc08 /doc | |
parent | 6d8cf25bd7d9d0836c7c894cffae2cdb4f6a2503 (diff) | |
download | Nim-b2c70190061233f2aaaaacdfb36f8f5181c1f514.tar.gz |
definite assignment analysis for let (#21024)
* draft for let daa * patch * fixes bugs * errors for global let variable reassignments * checkpoint * out param accepts let * add more tests * add documentation * merge tests
Diffstat (limited to 'doc')
-rw-r--r-- | doc/manual_experimental.md | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/manual_experimental.md b/doc/manual_experimental.md index 0611f55a7..a40dfedce 100644 --- a/doc/manual_experimental.md +++ b/doc/manual_experimental.md @@ -1859,6 +1859,20 @@ before it is used. Thus the following is valid: In this example every path does set `s` to a value before it is used. + ```nim + {.experimental: "strictDefs".} + + proc test(cond: bool) = + let s: seq[string] + if cond: + s = @["y"] + else: + s = @[] + ``` + +With `experimental: "strictDefs"`, `let` statements are allowed to not have an initial value, but every path should set `s` to a value before it is used. + + `out` parameters ---------------- |