[plt-scheme] exporting mutable identifiers

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun May 3 13:40:43 EDT 2009

This bug is (just) now fixed. Thanks for the report!

At Fri, 1 May 2009 21:24:02 -0700 (PDT), Michele Simionato wrote:
> The R6RS (section 7.2) says that
> """
> All explicitly exported variables are immutable in both the exporting
> and importing libraries. It is thus a syntax violation if an
> explicitly exported variable appears on the left-hand side of a set!
> expression, either in the exporting or importing libraries.
> """
> 
> I tried this program
> 
> #!r6rs
> (library (experimental mod1)
>   (export x incr-x)
>   (import (rnrs))
> 
>   (define x 0)
>   (define (incr-x)
>     (set! x (+ 1 x))
>     x)
> )
> 
> on Ikarus, Ypsilon and Larceny and indeed it fails with a "attempted
> to mutate an immutable variable" error. However plt-r6rs does not give
> any warning and compiles the library just fine, at
> least in PLT 4.0. Maybe this has been fixed in later versions but I
> wanted to report it,
> just to ask what it is the situation now.
> 
>     Michele Simionato



Posted on the users mailing list.