addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscontroller-playcredit-cardcrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobe--smallglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1launch-new-window--smalllight-bulblinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruserwarningyahoo

B'more on Rails Message Board › JRuby Presentation Followup

JRuby Presentation Followup

Keith B.
Chiang Mai, TH
Post #: 46
All -

Thanks for the opportunity to speak at the meeting last week, and for keeping it lively with questions.

There are some links below, at the end of this message. Also, I've looked into resolving some of those questions, and here's what I found:

1) Where is JRuby's sprintf functionality implemented?

Just as Chris said, JRuby's sprintf functionality is written in Java. It is distinct from Java's sprintf functionality and C Ruby's sprintf implementation. It is, of course, intended to be identical in *behavior* with C Ruby's sprintf.

The JRuby sprintf Java code is at­.

2) I mentioned that I was unable to see any effect of the JRuby use of 'include' to indicate that the class in which it is declared implements a certain interface.

I made a sample script to illustrate it, posted it on Github (https://gist.github.c...­, asked on the JRuby mailing list about it, and got an answer from Charlie Nutter, principal architect and author of JRuby. He said that the include statement is not necessary, but using it will allow JRuby to do things to improve performance and Java integration:

"Using include will perform a bit better because we can immediately see the interfaces the object supports and we also can make the Java object representing the Ruby object *actually* implement those interfaces rather than generating/instantiating a separate object attached to the Ruby object.

"I believe dispatch from Java through the interface is faster using a class + include than the "magic" form too."

3) I was not clear in my description of the function 'become_java!'

It is used in conjunction with the adding of (Java) annotations to a JRuby class. In order for the added annotations to be accessible to Java, it is necessary for the class to be Java class. (In contrast, it is *not* necessary for a class to be a Java class to implement a Java interface; a Ruby class works fine.)


Presentation Slides -­

"Using JRuby" - an excellent book about JRuby, at­

- Keith

Keith Bennett­
Powered by mvnForum

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy