[Larceny-users] finding libraries

William D Clinger will at ccs.neu.edu
Wed Dec 10 10:20:49 EST 2008


Jon Wells wrote:
> Has there ever been any discussion of allowing import clauses to appear
> anywhere other than the toplevel...

Yes, there has been some discussion.  However...

> So one could...
>
>    (import (rnrs))
>           :
>    (if <some-arbitrary-condition>
>       (import (a guff))
>       (import (different guff)))
>           :
>    <refer to things exported by guff>

That would be a bad idea for several reasons.  For
one thing, the scope of the conditional imports
would be unclear; to drive that point home, consider
what happens when you import in one branch of the
conditional but not in the other.  It would then be
impossible to compile the scope of the conditional
imports because the compiler wouldn't even know the
names being imported.  Even if the compiler were
able to figure that out, you'd have to describe
some semantics for the case where the sets of
identifiers imported by the conditional imports
were different, and I don't think you'd be able
to come up with a reasonable semantics for that.

Hence no one has proposed conditional imports in
the form you suggested above.

Furthermore the R6RS forbids all such extensions,
presumably in an attempt to improve portability of
R6RS code.  Implementations that claim to implement
the R6RS while providing such extensions would be
violating one of the "absolute requirements" of
the R6RS.

I have to admit that some of the R6RS's "absolute
requirements" are really dumb.  That is part of
why no one has yet released an R6RS-conforming
implementation.

Will



More information about the Larceny-users mailing list