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

From: Michele Simionato (michele.simionato at gmail.com)
Date: Sun May 3 13:25:29 EDT 2009

On Sun, May 3, 2009 at 6:30 PM, Andre van Tonder <andre at het.brown.edu> wrote:
> I can only speak for Larceny.  I believe this behaviour is allowded by R6RS
> and occurs as follows:  During expansion of (experimental defines), its
> syntax definitions have to be evaluated and so the identifiers are
> registered the first time.  I think that this must happen is obvious.  Then,
> during /expansion/ of the script x.ss, the library (experimental defines) is
> /visited/, in other words, its syntax definitions are evaluated, and this
> will cause the identifiers to be registered a second time - in general this
> must happen for syntax definitions that are used in the script.  In the
> present case, none of its syntax definitions are used, so this does not
> /have/ to happen but it happens anyway for consistency.  As far as I
> understand, Ikarus will only /visit/ imported libraries whose syntax
> definitions are in fact used in the importing library, which is also allowed
> by R6RS and would explain its different behaviour.
> In this case, Larceny basically adopted this aspect of its behaviour from
> the "compilable and composable macros" paper (by the athor of the PLT is
> model) and I believe the example in that paper will also help explain why
> things are registered twice in your example.
> As far as I understand, PLT /used to/ work similar to Larceny for your
> example. In other words, identifiers should be registered twice in PLT also
> in its model that used to be based on the same paper.  I don't know if there
> is some other error.  If you can get PLT to work, though, I would bet that
> the final printout that you get is (a b) and not (a b a b).  If you can get
> to that stage, I would be happy to explain why that happens.

No need to explain, I think I understand the behavior of Larceny and PLT now.
Your answer was very enlightening.

        Michele Simionato

Posted on the users mailing list.