[plt-scheme] metaphors for local
On Nov 5, 2007, at 5:27 PM, Prabhakar Ragde wrote:
> Matthias Felleisen wrote:
>
>> Most of what you have mentioned is flawed.
>
> I'm sorry, I wasn't clear. I meant something with the metaphoric
> power of the stack of books for a stack, or the cache of books for
> a cache. I didn't mean that these metaphors applied to local.
> Anyone coming from a primarily imperative background will, if they
> are not careful, try the stack metaphor and screw it up. (Since
> Pascal went away, the amount of experience with lexical scope out
> there has diminished dramatically, even if gcc does support it,
> sort of.)
>
>> I recommend to think of a pile of papers except that every
>> programmer has his own secret ink with which to definitions that
>> only he can read. Don't ever throw any of these papers away! You
>> might need them.
>
> Yes, but these papers are written at compile time and read at run
> time, and we don't have these notions when local is introduced in
> HtDP. At least we don't have mutation, either. --PR
Pardon my mistake:
1. Even if you use secret ink at both times -- writing the program
and evaluating it -- you don't get away with it. You need new secret
ink every time you evaluate a local.
2. The return has nothing to do with set!. Just look at the d/dx
example that I sent out for closures. Same problem.
-- Matthias