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

Detect pre-existing variables. #28

Closed
GiggleLiu opened this issue Aug 17, 2020 · 1 comment
Closed

Detect pre-existing variables. #28

GiggleLiu opened this issue Aug 17, 2020 · 1 comment

Comments

@GiggleLiu
Copy link
Owner

forbid x ← expr if x is already defined in the local scope.

@GiggleLiu
Copy link
Owner Author

GiggleLiu commented Aug 19, 2020

julia> using NiLang

julia> @i function f(x)
           y  0
       end

julia> @i function f(x)
           x  0  # if left side is already defined, should error
       end

@thautwarm , the second function should error at the variable analysis stage, however, NiLang is playing lazy to allow it pass. Wish to hear your advices about how to make the second function error correctly. I have a naive solution that records the input arguments and allocated variables. Is it possible to also detect global variables?

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