[racket] strange behavior

From: zermelo (zermelo at teletu.it)
Date: Tue Jan 31 07:38:39 EST 2012

I have the following problem. I want to replace procedure gensym with a 
to test a piece of software with predictable gensym values. When this is 
I restore the old gensym.
Thus I wrote this code in racket:

(define old-gensym gensym)
(define gensym <a mock ...>)
(define gensym old-gensym)

but when I run it, I get "reference to an identifier before its 
definition: gensym".
On the other hand, if I write the same code in the interaction window, 
everything works as expected.

Is this a bug?

Posted on the users mailing list.