Possible, yes. (Again, Turing-complete and all that.) But it depends what
you mean by "penalty".
The very first thing I think of when I think "Ruby and native extensions"
is RMagick/ImageMagick for a web site. And that's notoriously difficult to
build even in a C-based, MRI environment, although I understand that's
supposed to be better now in 2.0 (I haven't tried it yet).
What would the "right answer" be in JRuby? I just did some Googling, and
from what I can tell, there are a few ways you could go:
- JAI, which a bunch of people claim is too abstracted and buggy, and which
a bunch of others claim is fine and the first people are whiners
- Mistral, which provides an opaque abstraction over JAI, probably making
the first two bunches of people look like Red Sox and Yankees fans in a bar
with Scottish soccer fans
- ImageMagick via JNI (!)
- ImageMagick via exec (!!)
- ImageJ, which is pure Java but apparently has a lot of problems running
on a headless server due to its use of AWT; there's now a headless version
of the ImageJA fork, but apparently if you use any plugins you have to go
stub out all their AWT calls as wel, or something like that. Definitely
not a mature solution yet.
None of these sound all that appealing. You talk about loose coupling, and
when I think loose coupling, I think messaging. Which sounds good, and
obviously lends itself to parallel computing and multicore and grids and
all that, but as the Java world certainly knows, wrapping something like
ImageMagick in a messaging server would be a huge rat's-nest-infested
undertaking - and something that only someone with good experience in Ruby
AND Java AND image processing AND messaging could do.
As someone who's running about 1.5 out of 4 there, I'd probably just go
create a DRb/Rinda/whatever server for the ImageMagick stuff and deal with
having both a Java and a C environment going. But I wouldn't be very happy
about it, and it's certainly not generalizable.
You almost want some kind of messaging-oriented SWIG. Except SWIG itself
isn't even that easy to use (every time I think about using it, I end up
drifting toward Ruby::Inline instead; I think you only get the SWIG
advantage if you really target multiple languages.) So you want a
messaging-oriented BETTER SWIG. Without any of the complexity of SWIG. Or
messaging.
Thoughts?
···
On Sun, 11 Nov 2007 22:32:14 -0500, M. Edward (Ed) Borasky wrote:
For 2, given that Ruby operates on most platforms, it's almost always
possible to accomplish 2 using "loose coupling" with little or no
penalty.
--
Jay Levitt |
Boston, MA | My character doesn't like it when they
Faster: jay at jay dot fm | cry or shout or hit.
http://www.jay.fm | - Kristoffer