This is the mail archive of the
kawa@sourceware.cygnus.com
mailing list for the Kawa project.
Re: cannot 'require' in embedded code (AGAIN...)
- To: Marco Vezzoli <marco dot vezzoli at st dot com>
- Subject: Re: cannot 'require' in embedded code (AGAIN...)
- From: Per Bothner <per at bothner dot com>
- Date: 02 May 2000 00:02:04 -0700
- Cc: kawa at sourceware dot cygnus dot com
- References: <3906C21D.161F5EBA@flashnet.it> <390E6EC7.EE37E8AB@st.com>
Marco Vezzoli <marco.vezzoli@st.com> writes:
> I'm desperately trying to upload a compiled module inside an interpreter
> embedded in my java code.
> It seems that evalunating a "require" statement is the correct way,
Well, not really.
The thing to remember is that require is a *declaration*.
Furthermore, require creates *local* bindings, that are
not re-exported. I think the correct implementation
when evaluating a declaration (including require) is to
add the declared bindings to the eval's environment,
so (to the extent things are working as intended) what
you are doing should work. But I still think that in
the idea of eval'ing a require statement is unlikely
to be right thing. The point of require is that it is
part of a module system - which to me means compile-time
knowledge and control of exported/imported bindings.
Eval is about the opposite - no compile-time control.
In general, people overuse eval. The only really good
reason to use eval is when you need to evaluate a Scheme
expression *provided by a human at run-time*. There are
sometimes other good reasons to use eval - but most of
the time you shouldn't use it.
Note that you do have the option of calling load on a
compiled module. That may make more sense.
--
--Per Bothner
per@bothner.com http://www.bothner.com/~per/