guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Waddell/Dybvig module system


From: Neil Jerram
Subject: Re: Waddell/Dybvig module system
Date: 12 Jan 2001 14:49:54 +0000

>>>>> "Dirk" == Dirk Herrmann <address@hidden> writes:

    Dirk> To implement Dybvig's module system in an interactive
    Dirk> environment as guile's will lead to a couple of problems: In
    Dirk> the example above, we would like to be able to define 'y' in
    Dirk> module M, even after M was imported somewhere.  However,
    Dirk> after 'y' is defined in M, suddenly the semantics of the
    Dirk> command (list x y z) changes, because now y is taken from M
    Dirk> and no longer from the local scope.

No.  y is not included in M's interface, so a new or redefinition of y
in M has no effect on the binding of the identifier y in the importing
code.

    Dirk> IMO, this is a flaw in the system in general: The semantics
    Dirk> of the example code above is completely dependent on the set
    Dirk> of identifiers that is provided by M.  Changes to M can have
    Dirk> fatal consequences on code that imports M, even in a
    Dirk> compiled environment.  In other words: You rather don't use
    Dirk> import, but only one of the derived forms (like 'from').

Actually, I think the Waddell/Dybvig module system (WDM) is safer than
Guile's existing module system in this respect.

In WDM, the set of identifiers provided by M is specified by the
`module' form, and, because the module name M is only an identifier,
and only exists at translation time, this module form must appear in
the same enclosing lexical scope as the corresponding import form(s).
Therefore, unless we add further syntax such as `include' (which the
paper uses but doesn't define), M's interface specification must
appear in the same file as the code that uses M.

In Guile's existing module system, on the other hand, the module's
interface specification is in a different file; so it is much easier
for the interface to change without the user of the interface
realising.

On the other other hand, if we go with WDM, we'd obviously like to
emulate the existing module system with it.  So presumably - hopefully
- we will find some way of making WDM as unsafe as Guile already is.

Regards,
        Neil




reply via email to

[Prev in Thread] Current Thread [Next in Thread]