[3035] in java-interest

home help back first fref pref prev next nref lref last post

Re: Java eval?

daemon@ATHENA.MIT.EDU (David Forster)
Fri Oct 27 14:39:12 1995

Date: Fri, 27 Oct 1995 11:54:56 -0500
To: ser@jersey.uoregon.edu
From: mentor@io.org (David Forster)
Cc: java-interest@java.sun.com

At 17:31 10/26/95, ser@jersey.uoregon.edu wrote:
>Mario Ruggier asked:
>> Is it possible in Java to read a piece of Java code at runtime  and
>> execute it, as in Lisp, Smalltalk and Perl ?
>
>Are you asking if you can load a piece of Java code *into* a Perl script and
>execute it?  Or are you asking if you can cause a Java program to load in
>another piece of Java code and execute that?

No, I think he's asking if there's something like lisp's EVAL in Java,
i.e., can you do something like
  (eval '(print "Hi there!"))
which just executes the PRINT form.  [You'd think this is a pretty silly
thing to do, but it's the basis of the LISP Read-Eval-Print loop, which in
its simplest form is "(loop (print (eval (read))))" -- minus all sorts of
useful history-tracking stuff, of course.]

I don't think you can do this directly, but there's nothing to stop you
shipping code off to a server, compiling it there, and loading it back in.

Cheers,
  David Forster                <br><a href="http://www.io.org/~mentor">
  Mentor Software Solutions    </a><br>
  +1 905 832 4837              <br>


-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post