[plt-scheme] Re: how many times macros are defined?

From: Michele Simionato (michele.simionato at gmail.com)
Date: Sun May 3 04:35:27 EDT 2009

On May 1, 3:32 pm, Matthew Flatt <mfl... at cs.utah.edu> wrote:
> In PLT Scheme, the motivation for phase-specific bindings is not so
> much that we may want different names in different phases, but that we
> want to be specific about which code is running at which times. Without
> an enforced separation, we found that it was far too easy to
> accidentally have the run-time code depend on some initialization in
> compile-time code (e.g. loading a module, initializing some state), and
> that possibility made our builds and libraries fragile. (This problem
> is described more in the "Composable and Compilable Macros" paper.) So,
> we moved to a system that would tell us when we got it wrong, in much
> the same way that the compiler complains when a module contains a free
> variable.

The question of side effects is solved with multiple instantiation
of modules, which is independent from phase specification. In
principle one could have a system with implicit phasing and
multiple instantiation (say Ikarus with forced pre-compilation
of libraries in a different OS process).

> There's a spectrum in language design on how much the compiler checks
> statically versus how much is checked at run time, and static checks
> inevitably rule out some programs that could have run just fine. On the
> particular point of phase bindings, we've been happier with explicit
> declarations and static checking. I think this choice has been key to
> helping us build towers of languages that are far wider (lots of
> languages) and deeper (languages built on other languages) than
> anything else out there, that involve many implementors, and that we
> can keep running over many years.

I trust you and certainly the PLT module system is better than what
was available before ("load", "eval-when", bleah!). However,
to tell the truth, my experience as an user has been much happier with
implicit phasing than with explicit phasing, especially
when writing higher order macros.

         Michele Simionato

Posted on the users mailing list.