[plt-scheme] visualizing local in the Stepper

From: Prabhakar Ragde (plragde at uwaterloo.ca)
Date: Tue Oct 30 16:20:04 EDT 2007

An instructor reported this to me today. If the following program:

(define s_0 13)
(define (f a)
   (local
     [(define s 2)]
     (+ a s_0 s)))
(f 3)
s_0

is stepped through, the Stepper lifts the local definition to the top 
level, renaming s to be s_0. At least, that's what it says. It doesn't 
mean the same s_0 as in the first line, though.

The trace (as shown by the Stepper):
(f 3)
=> (local
  ((define s 2))
  (+ 3 s_0 s))
=> (define s_0 2)
(+ 3 s_0 s_0)  ; these are different
=> (define s_0 2)
(+ 3 13 s_0)   ; as we can now see
=> (define s_0 2)
(+ 3 13 2)
=> (define s_0 2)
18

Perhaps the Stepper could use a slightly better renaming mechanism for 
its display window? I know that students are not supposed to use 
underscores in their identifiers, but we shouldn't rely on that. --PR


Posted on the users mailing list.