softpano / pythonizer

Translator (or more correctly transcriber) from Perl to Python
http://www.softpanorama.org/Scripting/Pythonorama/Python_for_perl_programmers/Pythonizer/index.shtml
Other
39 stars 17 forks source link

Implement local #108

Open snoopyjc opened 2 years ago

snoopyjc commented 2 years ago

Implement local. Per the documentation, local actually defines a global variable, pushes the current value on a stack and makes a new value during the execution of this block. Once the block is done, the old value is popped back off the stack. This way if you call a function, the new value is available to that function. Some code uses local *var, which declares $var, @var, %var, &var, and var all local at the same time.

snoopyjc commented 2 years ago

Can implement with a global stack variable, and try: / finally:

snoopyjc commented 2 years ago

Fixed in 0.934: https://github.com/snoopyjc/pythonizer