On Wed, May 6, 2009 at 7:02 AM, Michele Simionato
<michele.simion...@gmail.com> wrote:
> Can you see how confusing is this?

BTW, here is another behaviour which caused me a lot of
confusion. Consider this library

(library (experimental visit)
(export a m)
(import (rnrs))
(define-syntax m
  (begin
    (display "visiting\n")
    (lambda (x) #f)))
(define a 42)
)

and this script

$ cat x.ss
(import (rnrs) (experimental visit))
;(m) ;; calling this macro "should" have no effect
(display a)

Notice that the call to the macro is commented. Superficially,
one would expect the code to behaves in the same mode
if the macro is called or not (this is a do-nothing macro, after all!).
Instead things are different when separate compilation is used.

$ ikarus --compile-dependencies x.ss
visiting
Serializing "/home/micheles/gcode/scheme/experimental/visit.sls.ikarus-fasl" ...

With the macro commented one gets:

$ ikarus --r6rs-script x.ss
42

With the macro NOT commented one gets

$ ikarus --r6rs-script x.ss
visiting
42

Now I understand the reason: the library is visited only when the
macro is called (here the library is instantiated for sure, since I access
the variable a). However, from the point of view of the programmer
not knowing the internals of Ikarus, he sees a do-nothing operation
which has an observable effect.

Reply via email to