News for hackers. Stuff that matters.
Re:Opal: Ruby to JavaScript Compiler by aikah on Thursday June 05, 2014 @09:57AM (#7851965)
afaik,it's not really a ruby to javascript compiler(like coffeescript compiles down to js).

You cant write xhr = XMLHttpRequest.new and expect it to compile in js.without importing some libs.

Re:Opal: Ruby to JavaScript Compiler by dragonwriter on Thursday June 05, 2014 @10:45AM (#7852200)
It is really a ruby to JS compiler.

Ruby, however, is not just a thin layer over JS the way CoffeeScript is. The thing you are referring to is a sign of CoffeeScript being a thin layer over JS, not CoffeeScript's compiler being a "real compiler".

Re:Opal: Ruby to JavaScript Compiler by seanewest on Thursday June 05, 2014 @11:56AM (#7852542)
Interestingly enough though they are both transpilers (source-to-source compilers).
Re:Opal: Ruby to JavaScript Compiler by aikah on Thursday June 05, 2014 @12:02PM (#7852578)
my point was it doesnt transpile Ruby to Javascript.
Re:Opal: Ruby to JavaScript Compiler by dragonwriter on Thursday June 05, 2014 @12:24PM (#7852684)
It does, though; it just doesn't expose things that are exposed in the underlying JS environment to Ruby code without jumping through certain hoops. Which makes sense, because unlike CS, which is tied to the underlying JS environment, Ruby isn't, and exposing the underlying JS environment would make it harder to port general-purpose Ruby code as you'd be more likely to run into collisions with the JS environment that you wouldn't see on other Ruby platforms.
Re:Opal: Ruby to JavaScript Compiler by aikah on Friday June 06, 2014 @07:16AM (#7857188)
My use case was an online IDE where instead of using javascript to code webapps,users would use Ruby to do the same.But since opal doesnt expose window object,it's pretty useless for me. Maybe you have a solution for that,but I just didnt find one.
Re:Opal: Ruby to JavaScript Compiler by dragonwriter on Friday June 06, 2014 @09:28AM (#7857701)
Exposing the window object is a different issue than being a transpired and, in any case, you can access the underlying KS environment in Opal, including fairly simple access to things like the window object.http://opalrb.org/docs/interacting_with_javascript/