[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: eval
From: |
Neil Jerram |
Subject: |
Re: eval |
Date: |
07 Feb 2001 22:40:42 +0000 |
>>>>> "Dirk" == Dirk Herrmann <address@hidden> writes:
Dirk> On 7 Feb 2001, Marius Vollmer wrote:
>> Hmm, what about simply `primitive-eval', to go with
>> `primitive-load', etc.
Dirk> Well, personally I don't like these names: ...
Dirk> But, I agree with you that "eval*" is also not a good
Dirk> choice: ...
Dirk> Another suggestion: - (eval/no-module-restore <exp> [<env>])
I've tried to think of a good name for `eval-in-current-module'.
`inline-eval'? `dynamic-eval'?
At least `eval-in-current-module' fits naturally with the other
procedures that manipulate the `the-module' fluid, namely
`current-module' and `set-current-module'. But I find I'm not happy
with `eval-in-current-module' in contexts like the repl:
(start-stack 'repl-stack
(eval-in-current-module sourc))))
To me, this _feels_ like:
(start-stack 'repl-stack
(local-eval sourc))))
In fact, of course, it is _very_ different. The problem is the
implicit reference to `the-module'. Yet, if we follow Dirk's
suggestion of making the reference explicit, as in
`(eval/no-module-restore exp (current-module))', and `exp' is
`(define-module (some thing))', we arrive back at the interpretation
of a meaningless (IMO) expression.
Perhaps, after all, the Right Thing is not to try to support `(eval
exp env)' where `exp' is an expression that would like to change the
currently selected module so that the change lasts beyond the
completion of the `eval'.
- In the repl, we can switch modules using a meta-command like
`,module'.
- When loading a module, the module loader can create and select the
new module before evaluating expressions from the module file. So
there is no need for `define-module' to switch module.
- We can consistently re-interpret `define-module' as:
- syntax: define-module MODULE-NAME PROPERTIES...
Define properties for the module MODULE-NAME according to
PROPERTIES. PROPERTIES may include:
:export (IDENTIFIER...) - specify exported identifiers
:use-module MODULE-NAME - add MODULE-NAME to import list
...
`define-module' throws an error if evaluated other than in
the context of loading the named module, or if properties for
the named module have already been defined.
This approach only needs R5RS `eval' and eliminates the need for
`eval-in-current-module'.
Neil
- Re: eval, (continued)
- Re: eval, Marius Vollmer, 2001/02/04
- Re: eval, Dirk Herrmann, 2001/02/04
- Re: eval, Marius Vollmer, 2001/02/04
- Re: eval, Dirk Herrmann, 2001/02/05
- Re: eval, Marius Vollmer, 2001/02/06
- Re: eval, Dirk Herrmann, 2001/02/07
- Re: eval, Marius Vollmer, 2001/02/07
- Re: eval, Dirk Herrmann, 2001/02/07
- Re: eval,
Neil Jerram <=
- Re: eval, Dirk Herrmann, 2001/02/09
- Re: eval, Neil Jerram, 2001/02/09
- Re: eval, Marius Vollmer, 2001/02/09
- Re: eval, Neil Jerram, 2001/02/10
- Re: eval, Dirk Herrmann, 2001/02/09
- Re: eval, Marius Vollmer, 2001/02/10
- Re: eval, Neil Jerram, 2001/02/10
- Re: eval, Dirk Herrmann, 2001/02/11
- Re: eval, Neil Jerram, 2001/02/12
- Re: eval, Marius Vollmer, 2001/02/12