<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'><div dir='ltr'>
When I run the following code in DrRacket it behaves somewhat differently than the documentation says a module should. <br><br>(module m racket<br>&nbsp; (define x 10)<br>&nbsp; (define cons 1))<br><br>The Racket reference says:<br>---------------------------------------------------------------------<br>One difference between a module and a top-level definition is that a module can be declared without instantiating its module-level definitions. Evaluation of a require instantiates (i.e., triggers the instantiation of) a declared module, which creates variables that correspond to its module-level definitions.<br><br>For example, given the module declaration<br>(module m racket<br>&nbsp; (define x 10))<br><br>the evaluation of (require 'm) creates the variable x and installs 10 as its value. This x is unrelated to any top-level definition of x.<br>--------------------------------------------------------------------------<br><br>But when I run the above code, the interactions window shows that x is defined as 10 even though I don't execute a require statement.<br><br><br>Also the Racket Guide says:<br>----------------------------------------------------<br>A module-level define can bind only identifiers that are not already bound within the module. For example, (define cons 1) is a syntax error in a racket module, since cons is provided by racket. A local define or other binding forms, however, can give a new local binding for an identifier that already has a binding; such a binding shadows the existing binding.<br>------------------------------------------------------<br>But DrRacket doesn't give an error for (define cons 1) and the interactions window shows cons has been redefined as 1.<br><br>Could someone explain why the behavior in DrRacket differs in these cases from the documentation.<br><br>Thanks in advance,<br>Harry Spier<br> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp </div></body>
</html>