News for hackers. Stuff that matters.
Re:Opal: Ruby runtime and library on top of Javascript by julius on Sunday May 22, 2011 @05:22AM (#2572949)
I have been using a similar project (Red) for a year in production.

Here is why we wanted to use it:

- Development speed (ruby can be typed so much faster and has a class system)

- Packaging system (we want one minified js-file)

- Code reuse (we use Ruby in the backend)

Here is why we stopped using it in favour of native JS:

- Slow runtime (try to read some big JSON in your favourite js-ruby, we had time diffs of 20secs to 0.2secs native js speed)

- Debugging (this is the most annoying thing, which you will not realize in the beginning)

- Development speed (recompiling time increases the more accurate the ruby implementation gets - my fork actually used multiple cpu cores)

- Red was immature (had my own totally rewritten fork going...)

I still love projects like this, but the mentioned problems will not all go away any time soon (a few of them might).

By the way, CoffeeScript shares some of these downsides, but is far less of a pain, because the whole language was designed with JS in mind (fast compilation, fast runtime etc.).

Re:Opal: Ruby runtime and library on top of Javascript by DanielRibeiro on Sunday May 22, 2011 @12:52PM (#2573634)
Actually, as stated on Coffescript's wiki[1], there are many other implementations of ruby on JS:

    * HotRuby Runs opcode, compiled by YARV on Ruby inside a web browser or in Flash.

    * rb2js Converts Ruby to JavaScript.

    * Red Writes like Ruby and runs like JavaScript

    * Quby Used for game coding site, not open source.

    * Opal Ruby to Javascript compiler.
It seems interesting that nobody has tried to use Rubinius (which tries to implement Ruby in Ruby) to leverage any of these implementations, possibly reusing a JIT mechanism.

[1] https://github.com/jashkenas/coffee-script/wiki/List-of-lang...

Re:Opal: Ruby runtime and library on top of Javascript by blueskey52 on Sunday May 22, 2011 @02:54AM (#2572819)
Looks like a cool project, but it would be nice if the docs were a little more complete or there was a try it out feature like on http://jashkenas.github.com/coffee-script/
Re:Opal: Ruby runtime and library on top of Javascript by adambeynon on Sunday May 22, 2011 @06:04AM (#2572985)
Docs are definitely being worked on, kinda the top priority now that the language and runtime are pretty stable.
Re:Opal: Ruby runtime and library on top of Javascript by DrCatbox on Sunday May 22, 2011 @05:28AM (#2572953)
What does it mean when something is 'on top of' another thing in computing?
Re:Opal: Ruby runtime and library on top of Javascript by orta on Sunday May 22, 2011 @05:32AM (#2572959)
In cases like this it means that the language was built to compile down into the other language. So you can write ruby code andnthat spits out JavaScript for thte browser to read.

Same thing with coffee script / objective-j

Re:Opal: Ruby runtime and library on top of Javascript by benatkin on Sunday May 22, 2011 @01:04AM (#2572666)
I can't tell what .rb is intended to run on the ruby interpreter, what .rb is intended to run with Opal, and what .rb is intended to run on both.
Re:Opal: Ruby runtime and library on top of Javascript by india on Sunday May 22, 2011 @03:40AM (#2572861)
Opal seems to be compiling the rb file to a js file. This js along with the supplied opal.js will run in the browser.

Check out https://github.com/adambeynon/opal/tree/master/examples/brow...

Re:Opal: Ruby runtime and library on top of Javascript by pforpal on Saturday May 21, 2011 @11:59PM (#2572569)
is there an associated product or project that this was developed along with? I am curious as to how this is being used
Re:Opal: Ruby runtime and library on top of Javascript by adambeynon on Sunday May 22, 2011 @06:02AM (#2572984)
Im using it for an internal project. There is an associated `vienna` gem, that is for building rich web apps (think sproutcore, cappuccino). It is not open source yet, but will be once the project its been written for is finished.
Re:Opal: Ruby runtime and library on top of Javascript by juiceandjuice on Sunday May 22, 2011 @01:38AM (#2572717)
Thought this was gonna be this: http://www.opalvoip.org/
Re:Opal: Ruby runtime and library on top of Javascript by buster on Sunday May 22, 2011 @05:09AM (#2572937)
Re:Opal: Ruby runtime and library on top of Javascript by rawsyntax on Saturday May 21, 2011 @11:56PM (#2572560)
Interesting that it has partial node.js compatibility