<div>Dear list members,<br></div><div><br></div><div>While playing around with Racket in DrRacket, I accidently entered in the interactions window.</div><div>> (define x 7)</div><div>> (define x 8)</div><div><br></div>
<div>and DrRacket allowed it, i.e. I didn't get a "duplicate definition of identifiers error message.</div><div><br></div><div><br></div><div>So to try and figure out what was going onI then entered this in the definitions window of DrRacket::</div>
<div><u><strong>Code snippet A</strong></u></div><div>(define-namespace-anchor a)<br>(define ns (namespace-anchor->namespace a))<br>(eval '(begin (define x 7) (define x 8)) ns)<br>(eval 'x ns)</div><div><br></div>
<div>and still no "duplicate definitions error".</div><div><br></div><div>I then tried this:</div><div><u><strong>Code snippet B</strong></u></div><div>(define x 9)<br>(define-namespace-anchor a)<br>(define ns (namespace-anchor->namespace a))<br>
(eval '(begin (define x 7) (define x 8)) ns)<br>(eval 'x ns)</div><div><br></div><div>and I got the error message: "cannot redefine a constant x"..</div><div><br></div><div>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.</div>
<div><br></div><div>Many thanks,</div><div>Harry Spier</div><div><br></div>