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

From: Michele Simionato (michele.simionato at gmail.com)
Date: Fri May 1 08:54:01 EDT 2009

On May 1, 1:36 pm, Matthew Flatt <mfl... at cs.utah.edu> wrote:

> The current version prints "metalevel 2" only once.

I see, so my understanding was correct and I have just
encountered a passing-by implementation detail.

BTW, I have another question. In future Adventures I want to explain
the difference between systems with implicit phasing
(like Ikarus) and systems with explicit phasing (like PLT and
Larceny).

The difference - as you know better than me - is that systems like PLT
andLarceny can import names into a specific phase, whereas
Ikarus necessarily imports the names into all phases.
In principle Larceny and PLT are more powerful since they
give you more control; in practice however I am having trouble
in finding real life use cases where to import names into a
specific phase only is necessary. For instance, I wrote this,
but it seems to me a pretty weak use case:

"""
Suppose for instance you are a teacher, and you want to force
your students to write their macros using only a functional
subset of Scheme.
You could then import at compile time all R6RS procedures
except the nonfunctional ones (like ``set!``) while importing
at runtime the whole of R6RS.
"""

Do you have more practical use case to suggest?

There is yet another thing that troubles me.
The R6RS document forbids the same name
to be used with different bindings in different phases.
Therefore, if I import the name 'x' at expand time (just to make
an example) I am basically reserving the name 'x' for all phases,
since I cannot reuse 'x' in other phases, unless it has the same
binding as the first 'x'. In other words, the namespaces in the
different phases are not really separated, and thus I could as well
import the name 'x' in all phases, since I cannot re-use it with
another meaning anyway.

Do you have any thoughts on the subject? I am sure I am missing
something.

                Michele Simionato


Posted on the users mailing list.