aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-07-09 16:29:28 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-07-09 16:29:28 +0200
commit81f2c76e51801b352961ca482294ed2dd31437af (patch)
treed3f4e6f40b8d470fb227ace279d1faaa4c1fd9a0
parent83f6043dc8ba291ba6d406f9ba0d98abf053e03a (diff)
Document some more bugs
-rw-r--r--BUGS31
1 files changed, 22 insertions, 9 deletions
diff --git a/BUGS b/BUGS
index aa34414..c8bf8b6 100644
--- a/BUGS
+++ b/BUGS
@@ -1,14 +1,16 @@
-1. Nested functions should inherit constants from parent scopes, but not
- local variables. At the moment the former works, but when trying to
- (incorrectly) use a local variable from an outer scope in an inner
- function, the compiler crashes:
+1. Nested functions should inherit constants and static locals from
+ parent scopes, but not automatic local variables. At the moment the
+ former works, but when trying to (incorrectly) use a local variable
+ from an outer scope in an inner function, the compiler crashes:
- foo :: () {
- x := 42;
- X :: 69;
+ example :: () {
+ x := 42;
+ x′ :: 69;
+ static x″ := 420;
- bar :: () int { return x; } /* not fine; breaks */
- baz :: () int { return X; } /* totally fine */
+ foo :: () int { return x; } /* not fine; breaks */
+ bar :: () int { return x′; } /* totally fine */
+ baz :: () int { return x″; } /* totally fine */
}
This is presumably due to the compiler maintaining a single tree of
@@ -28,3 +30,14 @@
x: int = -1;
return x;
}
+
+4. Variable shadowing breaks when you create a local variable with the
+ same name as the parent function, failing with a circular-dependency:
+
+ foo :: () { foo := 5; }
+
+ This is not an issue with nested functions:
+
+ foo :: () {
+ bar :: () { foo := 5; }
+ }