Charles Oliver Nutter
10/28/2007 4:38:00 PM
Ari Brown wrote:
>
> On Oct 28, 2007, at 2:45 AM, Charles Oliver Nutter wrote:
>
>> What more would folks like to know about?
>
> I'd just like to say, thank you so much for JRuby. I haven't had a
> chance to actually use it yet, but the fact that it's out there means a
> lot to me.
>
> My dad is a Java fanatic. Drinks his coffee every morning, then goes and
> practices Java.
> When he saw this on a job application (like "have you ever done JRuby"),
> he wanted to learn more about it. So now he's starting out.
>
> But here's my question:
>
> Can you set the compiler to generate the .class files, and then just run
> those on someone else's computer?
Yes, you can precompile .rb files and use them as standalone files.
There's a minor startup hit for loading precompiled classes, but the
upside is that you don't have to wait for JRuby to JIT compile them at
runtime as they're used; they'll be fast immediately.
What we don't have just yet is all the nice little features a compiler
should have, like compiling an entire target directory, compiling to a
specific output dir, tasks for rake, raven, buildr, maven, ant,
whatever. We also are looking for input on how best to incorporate the
compiled files into the loading process. Like Python's pyc files, where
if the compiled file is newer it runs that, otherwise it runs the
uncompiled .py file?
It's also worth mentioning that the compiled Ruby files are not really
directly-usable Java classes...they're compiled Ruby scripts. Just as
you can't instantiate a script as its own object or call methods
directly on a script, so can you not do that with a compiled Ruby
script. You must launch or the script and let it run through, defining
methods and classes and so on.
I have plans for a second compiler that will turn a Ruby class into a
more normal, instantiable, callable Java class, but that will come after
1.1.
- Charlie