source-academy / cs1101s

1 stars 0 forks source link

When to create new environments? #14

Open mrqorib opened 4 years ago

mrqorib commented 4 years ago

Question: I'm a bit confused by the extension of an environment and adding new frames. Are they essentially the same thing? Piazza: https://piazza.com/class/kas136yscf8605?cid=530

mrqorib commented 4 years ago

Answer: An environment is a chain of frames, always starting with the innermost frame, and always ending with the global frame.

When we create a new frame F (for evaluating a block or for applying a compound function), we create a new environment whose innermost frame is F.

So we can say "we create a new frame" or "we create a new environment". Both are correct.