[racket] free-id-table. Is it a bug?

From: Ryan Culpepper (ryanc at ccs.neu.edu)
Date: Thu Apr 3 13:00:21 EDT 2014

On 04/03/2014 12:42 PM, Roman Klochkov wrote:
> Thank you! Now I understand how to do it right.
>
>  > but then the
>     code it produces (the definition) changes the binding of ID
>
> Then why code without (module+ ..) works fine? Even in REPL all is fine.

The short answer is that it sometimes worked by accident.

Here's another example, though, that shows that the original problem 
wasn't limited to just module+:

   (save-and-define lambda)
   (load lambda) ;; => 'different

That produces 'different in the module (without the module+) or at the REPL.

It's essentially like mutating a key held by a hash table. Sometimes you 
get lucky, but you can't rely on it. The long answer depends on the 
details of the hash function. (For example, the example above depends on 
the fact that lambda was originally defined under a different name.)

Ryan


Posted on the users mailing list.