Pop Constructor Self Parameter Property

As LW Python creates variables for each constructor parameter, the paramter is popped from the "Parameters" list, so that LW Python can process the next parameter.

if the following are true:
  • expression state at time t = "call_build_args"
  • the expression at time t = Python constructor with name: class_name and arguments: args
  • Function Variables Map at time t = [ ]
  • Parameters List at time t = [ self, p_rest ]

then Parameters List at time (t + 1) = p_rest

For example, if the following are true:
  • expression state at time 21 = "call_build_args"
  • the expression at time 21 = Person("John", "Smith", 25)
  • Function Variables Map at time 21 = [ ]
  • Parameters List at time 21 = [ self, [ first_name, [ last_name, [ age, [ ] ] ] ] ]

then Parameters List at time (21 + 1) = [ first_name, [ last_name, [ age, [ ] ] ] ]

Try stepping through the simulator to see LW Python pop parameters from "Parameters."

Code Editor
LW Python State
Current Line1Current Tab0Time0
LW Python Simulator

Comments

Please log in to add comments