On Wed, May 6, 2009 at 6:18 AM, Derick Eddington
<[email protected]> wrote:
> On Tue, 2009-05-05 at 14:31 +0200, Michele Simionato wrote:
>> I find more intuitive and natural the
>> semantics such that all imported modules are instantiated
>> (say once and only once per OS process).
>
> To accomplish implicit phasing, Ikarus determines when instantiation is
> needed based on at what phases references to imported bindings occur.
> The on-demand semantics is a result of Ikarus's implicit phasing.

No, Ypsilon does implicit phasing but it instantiates the imported
modules always.

>  E.g., for the below, do you think (macro-helper) should always be
> instantiated?

Yes.

> (library (foo)
>  (export x)
>  (import (rnrs) (macro-helper))
>  (define-syntax s
>    (lambda (stx) (helper stx)))
>  (define x (s)))
>
> When (foo) is separately compiled, (macro-helper) needs to be
> instantiated for phase 1, but when pre-compiled (foo) is separately
> used, (macro-helper) does not need to be instantiated.  Since it doesn't
> need to be instantiated, why should it be?

Because the module macro-helper could have side-effects, such
as registering objects at compile time (I am still thinking of the
use cases in the Compilable and Composable Macros paper)

> Extrapolate this example to an import set (including all its transitive
> imports) with multiple libraries utilized only at (> phase 0) -- do you
> really want those libraries instantiated and consuming memory at
> run-time even though that's totally unnecessary?

Yes, all the languages I know work in this way, and nobody
complains about the waste of memory. I see this as a questionable
optimization that makes more difficult to reason with libraries.
In Ikarus a library can be instantiated or not (with
observable effects) depending if I reference an identifier
or not. This is confusing. Suppose I am importing a library
purely for its side effects and nothing happens. If I try
to debug it, I may try to print the value of some variable
exported by the library. Adding a (display some-variable)
expression for debugging purposes makes the library suddenly work
with side effects, but when I comment out the line the side
effects stop working again. Can you see how confusing is
this?

Reply via email to