> 1. A few chapters from now, when Lox supports first-class functions and dynamic dispatch, we technically won’t need branching statements built into the language. Show how conditional execution can be implemented in terms of those. Name a language that uses this technique for its control flow. Smalltalk? Lox doesn't have dictionaries, but in Ruby: ```ruby def if_(cond, t, f) { true => t, false => f }[cond].() end ``` > 2. Likewise, looping can be implemented using those same tools, provided our interpreter supports an important optimization. What is it, and why is it necessary? Name a language that uses this technique for iteration. Tail recursion, Lisp? FossilOrigin-Name: aec62b2632ecda95e950b0ea1a2cc7605db12f28cbbaf579f62519a4d5679aa4private
parent
66726f8e69
commit
d6f05497e3