Parla.py
Parla.py copied to clipboard
Global Variables Aren't Properly Captured By Spawn
The spawn decorator currently messes with the closure of the function it's passed to change the scoping semantics. (See https://github.com/ut-parla/Parla.py/blob/d82e6d573a5cd5b1e492a99a0106cd90e632961e/parla/tasks.py#L416.) Though the current commenting calls that a "hack", but it is actually an integral part of how Parla functions and uses only supported APIs. We need to double down on it for semantic consistency. The current handling only does this hack for nonlocal variables. We need to do it for globals too. Closures should acquire objects and not allow name lookups to be redirected through an outer scope.