On May 4, 2009, at 11:42 AM, Michele Simionato wrote:
On Mon, May 4, 2009 at 10:24 AM, Abdulaziz Ghuloum
<[email protected]> wrote:
... displays () because at the time the script is expanded,
or at the time when (define-registered names) is expanded,
there is nothing in the registry. Why did you expect to
see (a b) here?
Because this is the behavior of PLT (and I am sure also of
Larceny with separate compilation).
How did you come to expect that Ikarus should behave exactly
like PLT or Larceny?
My explanation is that at visit time
(define+ a 1)
is expanded into
(begin
(define-syntax dummy (begin (register #'name) (lambda (x) #f)))
(define a 1))
and the register is populated again (it was populated
the first time the library was compiled, but then erased
by the multiple instantiation mechanism).
It will be populated again if that library is visited, but
because there is nothing in your code that forces a visit,
none of these dummy definitions are evaluated in Ikarus.
The trick of the dummy macro, which I have copied from the
Composable and Compilable paper, is there just to guarantee
side effects to survive across separate compilation, because
at visit time all modules are revisited. At least this is my
understanding of how PLT/Larceny work.
Your understanding of PLT/Larceny is correct. Ikarus, on the
other hand, does not visit all libraries that are imported.
It only visits the libraries it needs to visit (e.g., when you
use a macro that's defined in that library).
If Ikarus does not work this way it seems that it is
impossible to rely on side effects to survive separate
compilation.
It's not impossible, just hard. Now I can probably improve the
situation a bit, but I don't really see much point in doing so.
This all a very tricky business, of course, and I may be
missing something,
Indeed. You're marching in murky waters. :-)
Aziz,,,