Variable created inside conditional block isn't visible in main program block
Opened this issue · 0 comments
sjoqvist commented
The specification says
All variable scope, as of this version, is local to the enclosing function or to the main program block. Variables are only accessible after declaration, and there is no global scope.
This makes me think that a variable should be visible within the function or main program block wherever it's defined, as long as that's above the point where it's accessed. However, the program
HAI 1.2
BOTH SAEM 1 AN 1
O RLY?
YA RLY
I HAS A variable ITZ "Hello World!"
VISIBLE variable
OIC
VISIBLE variable
KTHXBYE
generates the output
Hello World!
/tmp/hello.lol:8 variable does not exist: variable
I guess the actual scope is more narrow than the enclosing function. This seems like a bug to me, either in the implementation or in the specification.