Closed AndrewTolmach closed 1 year ago
Thank you for raising this issue! There was a paragraph in the Racket version that addressed this, but that paragraph had not yet made it into the Python version of the book. I've now brought that paragraph over to the Python version. It discusses what happens when the definitional interpreter encounters an error. And to further clarify, I've added a sentence to the discussion of the interpreter for Lvar that explicitly talks about undefined variables and I've added the footnote that you suggest.
Ch. 2 never explicitly discusses what happens for programs that use undefined variables. (In fact, the L_var typechecker and L_var and x86-var interpreters will die with an ungracious exception and the final x86 code will load from an uninitialized location.) In addition to potentially worrying students who practice good code-reading skills (surely one should always wonder what happens when a dictionary lookup might fail!) , this is a significant missed opportunity to mention the role of semantic checking, and to explain that the triangle diagram on p. 17 doesn't have to hold for programs that fail source (type)checking. (Indeed, the text doesn't even mention the existence of a checker for L_var.) I guess the idea is to delay that discussion until Ch. 5, but at least a footnote with a forward reference seemed merited here, e.g. at the bottom of p. 16.