[Top][All Lists]

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

Re: eval

From: Neil Jerram
Subject: Re: eval
Date: 06 Feb 2001 01:03:37 +0000

>>>>> "Marius" == Marius Vollmer <address@hidden> writes:

    Marius> What is wrong with this:

    Marius>     Conceptually, we should probably isolate the
    Marius> current-module from eval.  We should have
    Marius> `with-current-module' and `eval-in-current-module' [I like
    Marius> long names], and `eval' would be

    Marius>         (define (eval exp env) (with-current-module env
    Marius> (eval-in-current-module exp)))

    Marius>     The repl would use `eval-in-current-module'.

Yes, this -- with your subsequent explanation of its relation to the
`current-module' fluid -- is much nicer.  I presume that
`(interaction-environment)' will continue to be the same as

For the sake of analysis, I think the difference between this and
my/Dirk's approach is that Dirk and I were trying to find a way of
making expressions like

    (eval '(define-module (xyzzy))' <some environment>)

work sensibly, whereas your solution uses `eval-in-current-module' to
avoid the issue.  In retrospect, I suspect that expressions like this
one are fundamentally meaningless, so it is wise to avoid them!

One more thing.  I think that some confusion in this discussion may
have come from the mixing of the terms "environment" and "module".
All the questions that we have been discussing are concerned with
switching the top level environment in which the evaluator evaluates
an expression, which is more general than the way Guile implements
modules.  To this end, I'd personally be happier if we used
"environment" rather than "module" in the proposed names:


and, everywhere that a module is used as an environment, change

    ... m ...


    ... (module-environment m) ...


(define (module-environment m)
  ;; In the current module system implementation,
  ;; a module is the same as its top level environment,
  ;; but that may not always be the case.

But I'd be surprised if we hadn't discussed this question before :-)


reply via email to

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