<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<STYLE>.hmmessage P {
        PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px
}
BODY.hmmessage {
        FONT-FAMILY: Tahoma; FONT-SIZE: 10pt
}
</STYLE>
<META name=GENERATOR content="MSHTML 9.00.8112.16434"></HEAD>
<BODY class=hmmessage>
<DIV dir=ltr align=left><SPAN class=835164808-15082011><FONT color=#0000ff
face=Arial>About (define cons 1). Originally this was not permitted. On my
request this was permitted more than a year ago. The remark in the guide must be
a left over of old times. The reason I asked for this change is the following:
suppose you have a module that imports racket and defines a variable some-name.
Now if racket is extended to export a variable of the same name, your module
would no longer work. It is a matter of scope. It remains prohibited to import
the same variable from two different modules.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=835164808-15082011><FONT color=#0000ff
face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=835164808-15082011><FONT color=#0000ff
face=Arial>Jos</FONT></SPAN></DIV><BR>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT face=Tahoma><B>From:</B> users-bounces@racket-lang.org
[mailto:users-bounces@racket-lang.org] <B>On Behalf Of </B>Harry
Spier<BR><B>Sent:</B> lunes, 15 de agosto de 2011 6:02<BR><B>To:</B>
users@racket-lang.org<BR><B>Subject:</B> [racket] DrRacket and
Modules<BR></FONT><BR></DIV>
<DIV></DIV>
<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> (define x 10)<BR> (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> (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></DIV></BODY></HTML>