[racket] Duplicate definition of identifiers allowed in interactions window

From: Harry Spier (vasishtha.spier at gmail.com)
Date: Thu Nov 17 21:10:29 EST 2011

Dear list members,

While playing around with Racket in DrRacket, I accidently  entered in the
interactions window.
> (define x 7)
> (define x 8)

and DrRacket allowed it, i.e.  I didn't get a "duplicate definition of
identifiers error message.

So to try and figure out what was going onI then entered this in the
definitions window of DrRacket::
*Code snippet A*
(define-namespace-anchor a)
(define ns (namespace-anchor->namespace a))
(eval '(begin (define x 7) (define x 8)) ns)
(eval 'x ns)

and still no "duplicate definitions error".

I then tried this:
*Code snippet B*
(define x 9)
(define-namespace-anchor a)
(define ns (namespace-anchor->namespace a))
(eval '(begin (define x 7) (define x 8)) ns)
(eval 'x ns)

and I got the error message: "cannot redefine a constant x"..

Can someone explain to me why in code snippet A  in the definitions window
(and also simply entering (define x 7)  (define x 8) in the interactions
window) doesn't give me a duplicate definitions error.

Many thanks,
Harry Spier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20111117/644ee5a1/attachment.html>

Posted on the users mailing list.