Question 1 @ 2024-12-03 21:19
The subject of continuations (callbacks) and the translation of sequential code into “Continuation Passing Style”, fundamentally around:
- Static analysis
- Dynamic typing
- Type inference
- Polymorphism
- Control flow
- Lexical scope
- Dynamic scope
Question 2 @ 2024-12-03 21:21
What can we say about the CPS process?
(Choose the best answer.)
-
It needs to be done selectively: locally in places that require IO.
-
It needs to be done globally, CPS-ing a function forces all its callers to be CPS-ed as well.
-
It needs to be guided by IO types similar to the Slug types.
-
It requires the original code to be functional code, and cannot work on imperative code.
Question 3 @ 2024-12-03 21:24
What are features of CPS-ed code?
(Choose all features that are relevant.)
- All calls are tail calls.
- It cannot be statically typed.
- It can only be dynamically typed.
- It cannot allocate new heap space.
- It does not consume any stack space.
- It never returns values, only passes values onto continuations.
- It is sequentialized, meaning that evaluation order is fixed.
- It can speed up computation due to tail call optimization.