[plt-scheme] Re: side effects in R6RS modules

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

At Sun, 3 May 2009 08:46:56 -0700 (PDT), Michele Simionato wrote:
> On May 3, 4:53 pm, Chongkai Zhu <c... at cs.utah.edu> wrote:
> > Why the dirty trick?
> 
> Maybe because it was early in the morning and I was
> half asleep?
> 
> > This works:
> >
> > (define-syntax define+
> >   (lambda (x)
> >     (syntax-case x ()
> >       ((define+ name value)
> >        (begin (register #'name)
> >               #'(define name value))))))
> 
> Yes, now the script compiles and behaves as I would expect
> (even in Larceny).

With Chongkai's version, try the following in Larceny:

 * Running "x.ss" where none of the `experimental' libraries is
   compiled to "fasl" files.

 * Running "x.ss" where the `experimental' libraries are compiled to
   "fasl" files.

The first one will give you '(a b), while the second one will produce
'().


With Chongkai's version and the latest PLT Scheme, you'll get the same
result in both cases: '().


Getting different results via different compilation paths is exactly
why we moved to the current phase separation in PLT Scheme. We didn't
have time to try all combination of compilation options, and it was too
easy to create compilation-sensitive code.



Posted on the users mailing list.