Function Call Variables Rule

If the state is "call_build_args" and the function parameters list is empty at time t, then at time t + 1, the "Variables" map is updated to the "Function Variables" map at time t. More formally:

if the following are true:
  • expression state at time t = "call_build_args"
  • Parameters List at time t = [ ]

then Variables Map at time (t + 1) = Function Variables Map at time t

When the state is "call_build_args" and the function parameters stack is empty, Python has finished constructing the "Function Variables" map. Then, the current "Variables" map is saved to the stack, so now it is safe to make changes to the "Variables" map. This way, statements in the function body can access variables in the "Function Variables" map.

For example, if the following are true:

  • expression state at time 12 = "call_build_args"
  • Parameters List at time 12 = [ ]
  • Function Variables Map at time 12 = [ entry x: 5, [ ] ]

then Variables Map at time 13 = [ entry x: 5, [ ] ]

Try stepping through the simulator to see LW Python update the "Variables" map with function variables.

Code Editor
LW Python State
Current Line1Current Tab0Time0
LW Python Simulator

Comments

Please log in to add comments