What would you like to know about JRuby?

  • Thread starter Charles Oliver Nutter
  • Start date
C

Charles Oliver Nutter

Tom Enebo and I are putting together our JRuby presentation for
RubyConf, and there's just too much stuff to fit into 45 minutes. So
what areas would people most like to hear about?

- Rails (or Merb, Rack, etc) deployment
- Performance
- Java integration (calling Java libraries)
- FFI
- Ruby 1.9 support
- General compatibility
- How to help or contribute
- Technical/implementation details
- GUI development (there's also a MonkeyBars talk already)
- Graphics/game development

Others?

Hopefully the talks will be recorded as well, so those of you not at
RubyConf can see it too.

- Charlie
 
B

Bill Kelly

From: "Charles Oliver Nutter said:
Tom Enebo and I are putting together our JRuby presentation for
RubyConf, and there's just too much stuff to fit into 45 minutes. So
what areas would people most like to hear about?

- Rails (or Merb, Rack, etc) deployment
- Performance
- Java integration (calling Java libraries)
- FFI
- Ruby 1.9 support
- General compatibility
- How to help or contribute
- Technical/implementation details
- GUI development (there's also a MonkeyBars talk already)
- Graphics/game development

Others?

Applets?
- are applets supported? work OK or problematic?
- what's the minimum or typical jar file size to get a reasonable jruby runtime in an applet?


Thanks!

Bill
 
C

Charles Oliver Nutter

Bill said:
Applets?
- are applets supported? work OK or problematic?
- what's the minimum or typical jar file size to get a reasonable jruby
runtime in an applet?

Yeah, good idea. How about mobile too? We get a lot of questions about
whether JRuby could work on Android et al, and though we're not working
on it it's most definitely possible. I figure we could cover the current
state and possible future for both applets and mobile and give people
the step-by-step needed to make either work.

So much stuff we could include.

- Charlie
 
J

James Britt

Charles said:
Yeah, good idea. How about mobile too? We get a lot of questions about
whether JRuby could work on Android et al, and though we're not working
on it it's most definitely possible. I figure we could cover the current
state and possible future for both applets and mobile and give people
the step-by-step needed to make either work.

So much stuff we could include.

Indeed. I'd like to hear more about JRuby on the Web for non-Rails
apps. (I've been hacking around getting a straight-up Rack app up
running on Glassfish via Warbler, and want to do the same for a Ramaze
project; if there are others at RubyConf in the same boat give a yell,
we can swap war (ha ha!) stories.)


--
James Britt

www.happycamperstudios.com - Wicked Cool Coding
www.jamesbritt.com - Playing with Better Toys
www.ruby-doc.org - Ruby Help & Documentation
www.rubystuff.com - The Ruby Store for Ruby Stuff
 
C

Charles Oliver Nutter

James said:
Indeed. I'd like to hear more about JRuby on the Web for non-Rails
apps. (I've been hacking around getting a straight-up Rack app up
running on Glassfish via Warbler, and want to do the same for a Ramaze
project; if there are others at RubyConf in the same boat give a yell,
we can swap war (ha ha!) stories.)

Maybe there's enough interest in JRuby practicalities that we should try
to pull together a hackfest and/or BOF? As I understand it there's going
to be a lot of available rooms for that kind of thing. Anyone know how
BOFs and breakout rooms will be scheduled?

- Charlie
 
J

James Britt

Charles said:
Maybe there's enough interest in JRuby practicalities that we should try
to pull together a hackfest and/or BOF?

That'd work. I plan on hacking on Wiimote-driven Monkeybars app
(excited that I just picked up a very nice wireless IR sensor bar).





--
James Britt

www.happycamperstudios.com - Wicked Cool Coding
www.jamesbritt.com - Playing with Better Toys
www.ruby-doc.org - Ruby Help & Documentation
www.rubystuff.com - The Ruby Store for Ruby Stuff
 
R

Roger Pack

Charles said:
Tom Enebo and I are putting together our JRuby presentation for
RubyConf, and there's just too much stuff to fit into 45 minutes. So
what areas would people most like to hear about?

I won't be there but android support :)
-=R
 
D

Dick Davies

Tom Enebo and I are putting together our JRuby presentation for RubyConf,
and there's just too much stuff to fit into 45 minutes. So what areas would
people most like to hear about?

- Rails (or Merb, Rack, etc) deployment
- Performance
- Java integration (calling Java libraries)
- FFI
- Ruby 1.9 support
- General compatibility
- How to help or contribute
- Technical/implementation details
- GUI development (there's also a MonkeyBars talk already)
- Graphics/game development

Others?


I'd like a few examples of embedding Ruby into JEE - Ola Binis book had some
stuff on writing an EJB in Ruby for example, I've seen OpenESB demos
with JRuby scripts
as objects in the workflow, etc.

The Net is full of Rails+AR+MySQL+Jruby walkthroughs, but I'm trying
to write a JRuby MBean
(so i can run Ruby code when my cluster changes state)
and Google is looking back at me pretty blankly, I can tell you :)
 
C

Charles Oliver Nutter

Dick said:
I'd like a few examples of embedding Ruby into JEE - Ola Binis book had some
stuff on writing an EJB in Ruby for example, I've seen OpenESB demos
with JRuby scripts
as objects in the workflow, etc.

The Net is full of Rails+AR+MySQL+Jruby walkthroughs, but I'm trying
to write a JRuby MBean
(so i can run Ruby code when my cluster changes state)
and Google is looking back at me pretty blankly, I can tell you :)

There's actually some work going on in the GlassFish team to make Ruby a
first-class citizen of the Java EE world, so you could actually just
define an MDB in Ruby or a Sesion Bean in Ruby and it would wire all
that up. As painful and ugly as that sounds...we've seen other APIs
become actually pretty nice with a little Ruby sprinkled on them, and
it's an obvious way to start using it in an existing EE company.

For the moment though, we really just need to iron out the embedding
story. Three or four different APIs, all slightly different, all with
their own compatibility and migration stories. Not the best state of
affairs.

- Charlie
 
C

Chris Andrews

There's actually some work going on in the GlassFish team to make Ruby a
first-class citizen of the Java EE world, so you could actually just define
an MDB in Ruby or a Sesion Bean in Ruby and it would wire all that up. As
painful and ugly as that sounds...we've seen other APIs become actually
pretty nice with a little Ruby sprinkled on them, and it's an obvious way to
start using it in an existing EE company.

That sounds rather cool - do you have any pointers to more information?

I've actually chosen to get into J2EE for a new project based on the
ability to deploy both a Rails app and a JRuby MDB using the same app
together in Glassfish, and while it wasn't that difficult (even for
this EE newb), it's far from just writing some Ruby. If there was
something like the equivalent of Warbler for beans, that would be
ideal.


Chris.
 
C

Charles Oliver Nutter

Chris said:
That sounds rather cool - do you have any pointers to more information?

I've actually chosen to get into J2EE for a new project based on the
ability to deploy both a Rails app and a JRuby MDB using the same app
together in Glassfish, and while it wasn't that difficult (even for
this EE newb), it's far from just writing some Ruby. If there was
something like the equivalent of Warbler for beans, that would be
ideal.

Ahh, yeah, a "******" or something to package up Ruby + JRuby for EE
stuff. That's a good idea.

I don't have a link to it, since it's more internal discussion at this
point. Asking on JRuby mailing list would probably produce some
discussion. I believe the idea is that you would just be able to
configure a Ruby script or class as the MDB, for example, and GF would
know how to spin up JRuby and get at it. Sorta like how Spring can wire
in Ruby components (though Spring still ships JRuby 1.0ish, now
basically EOLed).

- Charlie
 
M

Maksim Ananjev

Tom Enebo and I are putting together our JRuby presentation for
RubyConf, and there's just too much stuff to fit into 45 minutes. So
what areas would people most like to hear about?

- Rails (or Merb, Rack, etc) deployment
- Performance
- Java integration (calling Java libraries)
- FFI
- Ruby 1.9 support
- General compatibility
- How to help or contribute
- Technical/implementation details
- GUI development (there's also a MonkeyBars talk already)
- Graphics/game development

Others?

Hopefully the talks will be recorded as well, so those of you not at
RubyConf can see it too.

- Charlie
 
M

Maksim Ananjev

I would greatly appreciate some general overview of the internals. Are
ruby files compiled into bytecode and then executed or java is invoked
to execute code line by line. If the first option is possible how do
you handle dynamic typing issues. Are any code optimizations applied
to ruby code?

Thanks
 
M

Maksim Ananjev

Oh, sorry. Rubyconf is over, I have not looked at the date of the
first message, shame on me :)
However I still will be grateful for the useful resources on this
topic. And looking forward for the presentation to be published
somewhere.
 
M

Maksim Ananjev

Oh, sorry. Rubyconf is over, I have not looked at the date of the
first message, shame on me :)
However I still will be grateful for the useful resources on this
topic. And looking forward for the presentation to be published
somewhere.
 
C

Charles Oliver Nutter

Maksim said:
Oh, sorry. Rubyconf is over, I have not looked at the date of the
first message, shame on me :)
However I still will be grateful for the useful resources on this
topic. And looking forward for the presentation to be published
somewhere.

No problem :) The talk should be published soon, but I can answer this
question here too.

JRuby is a mixed-mode implementation. We have both an interpreter that
walks the Ruby AST, just like Ruby 1.8 (though quite a bit faster), and
a compiler that turns Ruby into JVM bytecode. You can run all
interpreted, all compiled, or allow us to compile code just-in-time
(JIT) as the application runs. You can also compile all code
ahead-of-time (AOT) and ship .class files.

The compiled bytecode, however, is not exactly like a typical Java
class. Because Ruby's class structures are very fluid, we do not (can
not) present a normal Java type. So the compilation is solely to create
"bytecode chunks" that will be executed independently as method, block,
and class bodies. The .class that results from AOT compilation is
basically just a "blob of methods" that are wired up at runtime into
Ruby code bodies.

Is that clear?

Here's an example of the methods that result from compiling a very
simple script into a .class. The name mangling shows that we're using
these simply as blobs of bytecode:

[headius @ cnutter:~/projects/jruby]
$ cat foo.rb
class Foo
def bar
baz { }
end
end
[headius @ cnutter:~/projects/jruby]
$ javap foo
Compiled from "foo.rb"
public class foo extends org.jruby.ast.executable.AbstractScript{
public foo();
public static {};
public IRubyObject __file__(...);
public IRubyObject class_0$RUBY$Foo(...);
public IRubyObject method__1$RUBY$bar(...);
public IRubyObject block_0$RUBY$__block__(...);
public IRubyObject method__1$RUBY$bar(...);
public IRubyObject class_0$RUBY$Foo(...);
public IRubyObject __file__(...);
public IRubyObject load(...);
public static void main(java.lang.String[]);
}

The __file__ methods correspond to the body of the script. The two
class_0$RUBY$Foo methods represent the class body. The
method__1$RUBY$bar methods are the body of the "bar" method. The
block_0$RUBY$__block__ method is the body of the block. And finally the
load and main methods are used for loading this script as a library (via
require or load) and for executing it as a normal Java "main", respectively.

Generally, you don't need to know about any of this to get the benefit
of JIT or AOT compilation in JRuby.

- Charlie
 
L

List.rb

Hey Charles, I often find myself writing jruby scripts in java just
for the code completion on the larger java packages I work with.

Do you think netbeans will support java-library code completion for
jruby at some point? Thanks and hope this isn't off topic.



On Nov 19, 2008, at 7:57 AM, Charles Oliver Nutter <[email protected]
Maksim said:
Oh, sorry. Rubyconf is over, I have not looked at the date of the
first message, shame on me :)
However I still will be grateful for the useful resources on this
topic. And looking forward for the presentation to be published
somewhere.

No problem :) The talk should be published soon, but I can answer
this question here too.

JRuby is a mixed-mode implementation. We have both an interpreter
that walks the Ruby AST, just like Ruby 1.8 (though quite a bit
faster), and a compiler that turns Ruby into JVM bytecode. You can
run all interpreted, all compiled, or allow us to compile code just-
in-time (JIT) as the application runs. You can also compile all code
ahead-of-time (AOT) and ship .class files.

The compiled bytecode, however, is not exactly like a typical Java
class. Because Ruby's class structures are very fluid, we do not
(can not) present a normal Java type. So the compilation is solely
to create "bytecode chunks" that will be executed independently as
method, block, and class bodies. The .class that results from AOT
compilation is basically just a "blob of methods" that are wired up
at runtime into Ruby code bodies.

Is that clear?

Here's an example of the methods that result from compiling a very
simple script into a .class. The name mangling shows that we're
using these simply as blobs of bytecode:

[headius @ cnutter:~/projects/jruby]
$ cat foo.rb
class Foo
def bar
baz { }
end
end
[headius @ cnutter:~/projects/jruby]
$ javap foo
Compiled from "foo.rb"
public class foo extends org.jruby.ast.executable.AbstractScript{
public foo();
public static {};
public IRubyObject __file__(...);
public IRubyObject class_0$RUBY$Foo(...);
public IRubyObject method__1$RUBY$bar(...);
public IRubyObject block_0$RUBY$__block__(...);
public IRubyObject method__1$RUBY$bar(...);
public IRubyObject class_0$RUBY$Foo(...);
public IRubyObject __file__(...);
public IRubyObject load(...);
public static void main(java.lang.String[]);
}

The __file__ methods correspond to the body of the script. The two
class_0$RUBY$Foo methods represent the class body. The method__1$RUBY
$bar methods are the body of the "bar" method. The block_0$RUBY
$__block__ method is the body of the block. And finally the load and
main methods are used for loading this script as a library (via
require or load) and for executing it as a normal Java "main",
respectively.

Generally, you don't need to know about any of this to get the
benefit of JIT or AOT compilation in JRuby.

- Charlie
 
C

Charles Oliver Nutter

I believe it is planned, but I don't know the status. NB 6.5 largely
focused on bringing the set of features Ruby had in 6.1 up to speed on
other languages (Python, Groovy, JS). I expect that with that out of the
way, they'll all start getting additional new features at the same rate.

FWIW, NetBeans 6.5 is out as of yesterday. Very nice so far.
 
M

Maksim Ananjev

Charles, thanks a lot for your insightful description.
That's exact kind of overview I was looking for.


Maksim said:
Oh, sorry. Rubyconf is over, I have not looked at the date of the
first message, shame on me :)
However I still will be grateful for the useful resources on this
topic. And looking forward for the presentation to be published
somewhere.

No problem :) The talk should be published soon, but I can answer this
question here too.

JRubyis a mixed-mode implementation. We have both an interpreter that
walks the Ruby AST, just like Ruby 1.8 (though quite a bit faster), and
a compiler that turns Ruby into JVM bytecode. You can run all
interpreted, all compiled, or allow us to compile code just-in-time
(JIT) as the application runs. You can also compile all code
ahead-of-time (AOT) and ship .class files.

The compiled bytecode, however, is not exactly like a typical Java
class. Because Ruby's class structures are very fluid, we do not (can
not) present a normal Java type. So the compilation is solely to create
"bytecode chunks" that will be executed independently as method, block,
and class bodies. The .class that results from AOT compilation is
basically just a "blob of methods" that are wired up at runtime into
Ruby code bodies.

Is that clear?

Here's an example of the methods that result from compiling a very
simple script into a .class. The name mangling shows that we're using
these simply as blobs of bytecode:

[headius @ cnutter:~/projects/jruby]
$ cat foo.rb
class Foo
def bar
baz { }
end
end
[headius @ cnutter:~/projects/jruby]
$ javap foo
Compiled from "foo.rb"
public class foo extends org.jruby.ast.executable.AbstractScript{
public foo();
public static {};
public IRubyObject __file__(...);
public IRubyObject class_0$RUBY$Foo(...);
public IRubyObject method__1$RUBY$bar(...);
public IRubyObject block_0$RUBY$__block__(...);
public IRubyObject method__1$RUBY$bar(...);
public IRubyObject class_0$RUBY$Foo(...);
public IRubyObject __file__(...);
public IRubyObject load(...);
public static void main(java.lang.String[]);

}

The __file__ methods correspond to the body of the script. The two
class_0$RUBY$Foo methods represent the class body. The
method__1$RUBY$bar methods are the body of the "bar" method. The
block_0$RUBY$__block__ method is the body of the block. And finally the
load and main methods are used for loading this script as a library (via
require or load) and for executing it as a normal Java "main", respectively.

Generally, you don't need to know about any of this to get the benefit
of JIT or AOT compilation inJRuby.

- Charlie
 
N

Nathan

Indeed. I'd like to hear more about JRuby on the Web for non-Rails
apps. (I've been hacking around getting a straight-up Rack app up
running on Glassfish via Warbler, and want to do the same for a Ramaze
project; if there are others at RubyConf in the same boat give a yell,
we can swap war (ha ha!) stories.)

I am very interested in rack app deployment to non-glassfish
environmets. JBoss, Tomcat, etc. I am setting up vm's to test with
locally, but it's an uphill battle for me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top