Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable created inside conditional block isn't visible in main program block #38

Open
sjoqvist opened this issue Jul 25, 2016 · 0 comments

Comments

@sjoqvist
Copy link

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.

@sjoqvist sjoqvist changed the title Variable scope doesn't work as specified Variable created inside conditional block isn't visible in main program block Aug 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant