Written: Control

Question 1: Stack Space

Any program that consumes some amount of stack, when converted to CPS and run, suddenly consumes no stack space at all. Why?

As a corollary, does conversion to CPS reduce the overall memory footprint of the program?

Question 2: Stack Inspection

Java's native security model employs a mechanism called stack inspection (look it up if you aren't familiar with it). What is the interaction between stack inspection and CPS? That is, if we were to CPS a program, would this affect its security behavior?

If not, why not?

If so, how, and what would you suggest doing to recover security assuming the CPS conversion was necessary?

Question 3: Generators

In Python's generators, yield is a keyword, not a value bound to a function. In particular, you cannot pass yield as an argument to some other function, allowing that function to perform the yielding. In contrast, in Racket, the user program gets to pick the name of the generator's yielder, and this is an ordinary identifier bound to a value that can be passed as a parameter.

Discuss the advantages and disadvantages to the two designs.

Submit at this link: