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.
[ Parent
| on HN ]
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.
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/