[rjb-users] JRuby Compatibility?

arton arton at e07.itscom.net
Wed Nov 21 05:19:59 EST 2007


Hi

I like Java's original import statement' semantic, and good coding style
as per a class import style.
In fact, I never wrote 
import java.io.*;  // except for some testing or temporary programs
but
import java.io.IOException;  // it imports IOException as a class, not an array.
import java.io.FileInputStream;
...

So, Rjb's import is as it is. (But sometime I'd like to write "import
'java.io.*'", so supporting the wildcard '*' may be possible, if anyone
wants it.

> $ jirb
> irb(main):001:0> import 'java.util.Vector'
> => ["java.util.Vector"]
> irb(main):002:0> v=Vector.new
> => #<Java::JavaUtil::Vector:0x1cdfd19 @java_object=[]>
> 
> Between an import statement and the Rubyesque method
> names, the remaining syntax differences between JRuby
> and RJB/MRI would be pretty minor.
> 
> I'm not sure that's a direction you want to take RJB,
> but it seems like it could really make it easy to
> switch between MRI/RJB and JRuby as the need arises.
> 
> Cheers,
> Rich
> 
> --- arton <arton at e07.itscom.net> wrote:
> 
> > Hi,
> > 
> > Since Rjb-1.0.8, Rjb supports ruby style method name
> > for Java objects.
> > So, the main difference between Jruby and Rjb is the
> > importing method
> > for Java classes. (If you find more difference,
> > please let me know, I'll
> > fix it)
> > Below is my diary (something like blog)
> > http://arton.no-ip.info/diary/20070911.html#p03
> > This entry was written in Japanese, but the code is
> > Ruby, so I think you
> > can read and understand how it works.
> > 
> > Best regatds
> > 
> > -- 
> > arton
> > 
> > 
> > _______________________________________________
> > rjb-users mailing list
> > rjb-users at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/rjb-users
> > 
> 
> 
> ___________________________________
> 
> Richard L. Apodaca
> 
> http://depth-first.com      Blog
> http://metamolecular.com    Company
> _______________________________________________
> rjb-users mailing list
> rjb-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rjb-users

-- 
arton



More information about the rjb-users mailing list