Hello,

Hartmut Holzgraefe wrote:
> 
> Manuel Lemos wrote:
> >>Unless I'm mistaken, Java doesn't have eval.  Any language with eval
> >>needs a runtime environment when executing, even if the rest of the code
> >>is converted to C
> >
> > I am not expert in Java (actually I don't program in Java - MetaL
> > generates it for me if I ever need it), but I suppose that what eval
> > does is what java.lang.Compiler class is for.
> 
> java.lang.compiler is a little different ...
> 
> 1) Java *has* a complete runtime environment available at runtime,
>     the JVM and the standard classes, that's why JVMs tend to be so
>     big and have a rather large startup time overhead

What is the difference to PHP?

PHP also has to compile any sources before executing them. Actually I
think PHP is much better than Java because the runtime enviroment, which
is Zend compiler and all PHP extensions, was completely handwritten in
C.

 
> 2) java.lang.Compiler takes a java source file and compiles it
>     into a class file, so the result is persistent and you have
>     to have your code wrapped up to a complete class, write it
>     to filesystem, compile it, load the compiled class into the JVM
>     and then execute

PHP already does that. What is missing is the hooks to save the compiled
output to disk or for instance to somewhere in the network to run in a
distributed enviroment where not only the objects data but also the code
can migrate between machines.


>     eval just executes statements within the eingine, and what
>     you pass to it has to be just a complete statement, not a
>     whole class

Unlike Java, PHP code does not have to be a class. eval is like include
except that the source input comes for a string passed as argument. That
is what is called dynamic loading.

Regards,
Manuel Lemos

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to