Well, you could, couldn't you?

The output is a legal Java class files, so you are free to load it up
and use it safely in your Java class. You may need to initialize some
JRuby constructs before you call the method on that class, but how is
this different from any other API? Would you go around and arbitrarily
instantiate any Java objects you find in the class path, without looking
at the Javadoc first?

Let me add a specific, technical problem with using custom extension:
consider the JET compiler, which compiles java .class to native code. If
we leverage that to compile JRuby-compiled code, we can have (as far as
I know) the first native compiler for Ruby. I can see it compiling a
foo_bar.class into a foo_bar.obj, which, when
Class.forName("foo/bar.rb"), will load the native code version. If we
require a custom classloader, "foo/bar.rb" cannot be precompiled AOT
[1]. 

Don't get me wrong: I am a semantic police myself and I am all for being
semantically righteous, but this is not just an idle points. So that
existing tools can treat .rbj as .class, someone has to write all those
adapters. I personally don't want to ever look at Maven's source code
again.

[1]. Actually, I know of a cumbersome workaround, but it is messy and
still may not work.

Peter

-----Original Message-----
From: Dudley Flanders [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 19, 2007 4:15 PM
To: [email protected]
Subject: Re: [jruby-dev] Compile to .rbj instead of .class?


On Oct 19, 2007, at 4:06 PM, Peter K Chan wrote:
> Let me turn the table around: if the JRuby compiler/classloader can  
> deal with
> any extension, why does it need a custom extension? :)

Because if I see a .class file, that means I can load it up and use  
it safely in my Java class. The problem's not in the software, but in  
the wetware.

:dudley

---------------------------------------------------------------------
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

Reply via email to