guile-devel
[Top][All Lists]
Advanced

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

Re: eval


From: Marius Vollmer
Subject: Re: eval
Date: 04 Feb 2001 19:03:49 +0100
User-agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.7

Dirk Herrmann <address@hidden> writes:

> SOLUTION:
> ---------
> 
> Instead of having only one global variable 'the-module', we have
> 'the-module' and 'the-interaction-module'. [...]

I find this and what has been discussed in the sequel needlessly
complicated.  What is wrong with this:

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

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

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

    The only question that is left, as I see it, is whether to
    overload the name `eval' with both a two-argument and a one
    argument version, or we should have two distince names.  I can
    live with either solution.

    Because Dirk has expressed reservations about overloading one
    name, I suggest to have two names:

        eval                   
          - this is R5RS eval and does what eval does now.

        eval-in-current-module 
          - this is our previous eval which didn't switch the
            `current-module'

    We should probably also have these definitions

        (define (call-with-current-module mod proc)
          (save-module-excursion
            (lambda ()
              (set-current-module mod)
              (proc))))

        (define-macro (with-current-module mod . body)
          `(call-with-current-module ,mod (lambda () ,@body)))



reply via email to

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