This brings up an interesting moment in PLAI that always elicits totally blank 
stares: the moment in lecture that matches this part of the book, on page 34 of 
the current online version:


"Hopefully we can agree that the value of this program is 8 (the left x in the 
addition evaluates to 5, the right x is given the value 3 by the inner with, so 
the sum is 8). The refined substitution algorithm, however, converts this 
expression into

{with {x 5} {+ 5 {with {x 3} 5}}}

which, when evaluated, yields 10. What went wrong here? Our substitution 
algorithm respected binding instances, but not their scope.
In the sample expression, the with introduces a new scope for the inner x. The 
scope of the outer x is shadowed or masked by the inner binding. Because 
substitution doesn’t recognize this possibility, it incorrectly substitutes the 
inner x.
"

Many students say to me, "but... you're not allowed to define the same name 
twice!"  

At a minimum, then, this discussion has an interesting association with the 
definition of substitution (and the teaching thereof).

John

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_________________________________________________
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Reply via email to