source-academy / cs1101s

1 stars 0 forks source link

How to call primitive and predeclared functions using the environment model? #13

Open mrqorib opened 4 years ago

mrqorib commented 4 years ago

Question: if we were to use a predeclared function (e.g. math_pow(b, e)), does it mean that the frame which consists of the function parameters (b and e) points to the global environment instead? Piazza: https://piazza.com/class/kas136yscf8605?cid=521

mrqorib commented 4 years ago

Answer: math_pow is a primitive function, so it doesn't create any frame when it is called.

But for other pre-declared, but not primitive, functions, such as length, append, map, frames will be created, and they extend the global environment.