[racket] compile-enforce-module-constants parameter and redefinition of constants

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Thu Dec 22 09:31:32 EST 2011


Two definitions for a variable in the same scope never works. 
In the first case, Matthew would probably say "the top level
is broken." -- Matthias



On Dec 21, 2011, at 11:16 PM, Harry Spier wrote:

> Can someone explain why this example from the Racket Guide allows a
> re-definition of a constant but the second case (not from the Racket
> Guide) gives an error. Both are executed in the interactions window of
> DrRacket.
> 
> Many thanks,
> Harry
> 
>> (compile-enforce-module-constants #f)
>> (module m2 racket
>    (provide pie)
>    (define pie 3.141597))
>> (require 'm2)
>> (module m2 racket
>    (provide pie)
>    (define pie 3))
>> pie
> 3
>> 
> 
> 
> BUT
> 
>> (compile-enforce-module-constants #f)
>> (module m2 racket
>    (provide pie)
>    (define pie 3)
>    (define pie 4))
> .
> gives the error:  module: duplicate definition for identifier in: pie
>> 
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users



Posted on the users mailing list.