Charlie,
So, I see the semantic mismatch, but what is the technical reason for
having a separate extension?
I see some benefits of using the standard .class extension, such as
being able to compile JRuby compiled bytecode into native code (e.g. using the
JET compiler), or to run an obfuscator on the class files (imagine how
confused if someone were to try to decompile JRuby code to Java...). Besides,
wouldn't this require a separate classloader to load the byte code?
Granted, we may have some confusion when someone open up the Type
Editor in Eclipse and see a org.jruby.compiled.lower_case_class_name, but it
seems like a small price to pay.
Peter
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
Charles Oliver Nutter
Sent: Thursday, October 18, 2007 6:02 PM
To: [email protected]
Subject: [jruby-dev] Compile to .rbj instead of .class?
So yeah, the compiler's done, it can compile ahead-of-time to binary
files you can load and run and all that. Currently the extension for
those files is .class, but that's started to bother me a bit.
Here's the deal...it's not "really" a Java class file. You can't load
the class it contains and instantiate it normally and start calling
methods. It's just a bag of methods and runtime junk for the compiled
code. There will be an eventual compiler that can produce things more
like normal class files, but this isn't it.
I'm also planning a modification to the load sequence that will allow
loading these compiled format files directly out of load path, rather
than requiring classpath changes. So if you compile some/dir/foo.rb to
some/dir/foo.class, the load sequence will see the compiled version and
load that.
Because the loading of these compiled files requires a JRuby runtime and
extra logic to launch them correctly, I'm starting to think that naming
them .class isn't appropriate. They're really a custom format/layout for
JRuby that just happens to use the Java class file format and bytecode.
Beyond that, they're JRuby-specific.
So what would you all say to having the compiler produce a different
extension, like .rbj for "ruby compiled to Java bytecode"? I think it
better reflects the actual format and the way the files should be used,
and it would basically eliminate the chance of someone confusing this
for a normal Java class and intentionally (or accidentally) using it in
their own Java code.
Thoughts?
- Charlie
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email