Begin Constructor Arguments Property

Evaluating an object constructor is very similar to evaluating a function call. LW Python starts by pushing the constructor's arguments into the "Arguments" stack. More formally,

if the following are true:
  • expression state at time t = "begin_expr"
  • the expression at time t = Python constructor with name: class_name and arguments: args

then arguments stack at time (t + 1) = [ args, arguments stack at time t ]

LW Python pushes the arguments into the "Arguments" stack so that it can start evaluating the arguments. For example, if the following are true:
  • expression state at time 9 = "begin_expr"
  • the expression at time 9 = Person("John", "Smith", 25)

then arguments stack at time (9 + 1) = [ [ "John", [ "Smith", [ 25, [ ] ] ] ], arguments stack at time 9 ]

Try stepping through the simulator to see the arguments get pushed into the "Arguments" stack.

Code Editor
LW Python State
Current Line1Current Tab0Time0
LW Python Simulator

Comments

Please log in to add comments