Local Variable Scope
Opened this issue · 4 comments
HzanRsxa2959 commented
Sorry if this has been talked about before, but I didn't find any mention of it.
With the introduction of named local variables (#32), a way should be added add scope to them to avoid any potential name conflicts with opcode 0AB1.
x87 commented
@HzanRsxa2959 I think I understand what you are asking for, but can you please provide a few code examples where scoped variables are used?
HzanRsxa2959 commented
@x87 Here is some example code with the issues commented:
https://pastebin.com/9CyWwS38
Tested on Sanny Builder 3.7.0 released on 2021-1-30.
EDIT:
Also, I can't think of any example where nesting is necessary at all for scopes, at least in SCM.
x87 commented
another example
{$CLEO}
int x = 0
int y = 1
0AB1: cleo_call @fn 0
// cleo_call creates a local scope
:fn
int y = 1 // this is not the same 'y' as defined in the outer scope
cleo_return 0