

Snarl - A JavaScript Bridge for JRuby - mbrubeck
http://blog.joncrosby.me/post/237659479/snarl-a-javascript-bridge-for-jruby

======
bensummers
Nice, but very simple. I don't think there's a way of passing a Ruby object in
to the Javascript and calling methods on it, which is a shame.

~~~
ilyak
You can easily pass an object into Javascript:

context.put(“rubyObject”, MyRubyClass.new)

Whether you would be able to call methods on it depends on whether the Snarl
author did some (trivial) code magic or not, but it's certainly doable too.

Still I have no idea why would you want javascript in ruby in the first place.

~~~
bensummers
I looked at the code. I don't think that'd work.

As for using Javascript from Ruby, it might be quite nice as a language to let
your users write extensions and plugins. It's a language where the
implementations all have an emphasis on sandboxing.

~~~
ilyak
Why not? I mean, rhino has methodNotFound-like thing, so you certainly can.

~~~
bensummers
I meant I looked at the Snarl code, and it wasn't implemented there.

But you are right, it is technically possible.

------
pieter
Something similar is also possible with macruby: <http://pastie.org/690427>

