This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: Translators again
On Wed, Feb 09, 2000 at 06:14:24PM +0100, Jost Boekemeier wrote:
> Ian Bicking <bickiia@earlham.edu> writes:
> > It seems as though the REPL may not be implemented in a standard way
> > in many applications. That is, RPL are somewhat application-specific,
> > only the E really relates to Guile or the language.
>
> Isn't it possible for a foreign language implementor to
> implement a language specific eval?
I guess your implementation seems too tricky to me. It's much
easier for people to understand APIs that don't rename anything.
So, it would seem to me that something like:
(eval-string <some-input> #:language <some-language>)
would be the easiest to understand. It also occured to me that
the read/eval are hard to seperate clearly. In tcl->scheme I
made tcl:read and used the normal scheme eval, maybe another
language would seperate that differently.
Essentially, from the application side, you want to evaluate
a string, be it "(+ 1 2)" or "expr 1+2". You don't want to
do a language-specific read, then perhaps a language specific
eval, when you probably don't even care what the intermediate
form is in the first place.
> Lets assume someone wants to contribute the tcl module my.tcl. This
> person must also implement a foreign language interface module
> `my.scm' which exports my.tcl's interface to the scheme world -- possibly
> by inheriting the standard tcl repl and standard tcl eval from the
> (ice-9 lang tcl) module.
>
>
> A client of my.tcl would look like:
>
> (define-module (test-my-tcl))
>
> (module-open (ice-9 guile) ((user my) (rename eval tcl:eval)))
>
> (eval '(+ 1 2) (the-environment))
> (tcl:eval "1 + 2")
>
> ;; or:
>
> (module-open (user my) ((ice-9 guile) (rename eval system:eval)))
>
> (system:eval '(+ 1 2) (the-environment))
> (eval "1 + 2")
--
Ian Bicking / 4869 N. Talman Ave. Apt. G, Chicago, IL 60625
bickiia@earlham.edu / http://www.cs.earlham.edu/~bickiia