> Once in a while the question pops up if it is
> possible to compile Ruby
> code to native machine code. The answer has always
> been no. But I keep
> wondering how hard it would really be to make this
> possible.
The answer is really yes. Why? People say no because
of the implementation on how it is supposed to work.
It is very possible to, but it would take time.
>
> Ruby is written in C. And when Ruby parses a Ruby
> script it converts
> each statement to a C call. Probably the same calls
> you can use on your
> own in a Ruby C extension. So why wouldn't it be
> possible to parse a
> Ruby script and convert all statements to Ruby C
> code and put it in a
> *.c file (instead of calling the Ruby C statements
> directly). This *.c
> file can then be compiled into machine code with a C
> compiler like gcc.
Evaluated code at runtime needs to be thought of.
There needs to be a small runtime running on top of
the compiled program.
> Am I right on this, or do I forget something
> important which makes the
> above quite hard to do?
Just very hard to do and no one wants to bother with
creating it. Which is why I emailed "Ruby
specification" on the mailing list about creating
rubycc. --David Ross
__________________________________
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/...otelifeengine/