Open jnhnum1 opened 11 years ago
Generators can handle this particular example, but it would be nice if we could use this style of programming:
@closures def makeCounter(): x = 0 def foo(): x += 1 return x return foo
which would be transformed into
def makeCounter(): x = [0] def foo(): x[0] += 1 return x[0] return foo
We would probably need basic static analysis (https://github.com/lihaoyi/macropy/issues/44) in order to keep track of scoping and make sure it's the same variable we're assigning too
Generators can handle this particular example, but it would be nice if we could use this style of programming:
which would be transformed into