Com S 342 --- Principles of Programming Languages EXERCISE 10: REFERENCES (File $Date: 2005/03/28 07:07:37 $) The purpose of this exercise is for you to learn about how references are used in the interpreter of section 3.7. As with all exercises, this is to be done individually. And it is due the day this topic is planned to be discussed in class, unless specified otherwise (see the syllabus at: http://www.cs.iastate.edu/~cs342/syllabus.shtml). We expect this to help you think about the readings (see below). If you don't have an answer or an answer that you think is good, write down what you read, and a question or two that would have helped you make progress. Then you can ask that question in class; there will be other people with the same problem, and everyone can learn by discussing these issues. And you'll most likely see similar things on the homework, so it's best to understand them now. READINGS: Read section 3.7 of "Essentials of Programming Languages" (2nd ed., 2001) by Friedman, Wand, and Haynes. 1. [Understanding references] a. Why are references implemented using a position and a vector in Scheme? b. If you were working in C++, how would you implement references? c. In section 3.7, what's the difference between deref and primitive-deref? d. How does apply-env-ref create a reference? e. Why are references needed to implement assignment in the interpreter of section 3.7? WHAT TO HAND IN You should have at the beginning of class, your answers to the above questions (or questions and problems you encountered for each part). Make sure your name is on these. Attach the printouts, if any, requested above.