6 ms·
Convert Ruby to JavaScript
- tlrobinson 17y agoI'm sure you're all getting sick of me posting this link, but this is relevant: http://github.com/tlrobinson/cappruby/tree/master http://github.com/tlrobinson/cappruby/tree/master It's the same idea but it uses the Objective-J runtime which is similar to Ruby's runtime.
- judofyr 17y agoOr just use Red? http://wiki.github.com/jessesielaff/red http://wiki.github.com/jessesielaff/red
- petercooper 17y agoJust a note that this is three years old and somewhat outdated, but... it's still a pretty cool trick/idea, similar to the Ruby->PHP compiler mentioned here recently: http://www.ruby-php.org/ http://www.ruby-php.org/ I'm not sure, though, that it's useful enough to "break through." judofyr mentioned Red ( http://github.com/jessesielaff/red http://github.com/jessesielaff/red ) as a more production ready Ruby-JavaScript tool but even that hasn't been updated in a year it seems :-(
- threedaymonk 17y agoYes, I was quite surprised to see it being picked up after such a long time! It's just a quick implementation that I ran up in a lunch break one day. If you want to see a better implementation of a Ruby to JavaScript compiler, have a look at http://www.ntecs.de/projects.html http://www.ntecs.de/projects.html
- petercooper 17y agoIf you're Paul, I just want to give you a virtual knighthood for your work with iplayer-dl - as I'm sure thousands of others would love to.
- threedaymonk 17y agoThat's me. Thanks, I accept! Do I get a sash or a garter or something?
- camccann 17y agoI don't mean this as an attack, it's an honest question: Why? I don't grasp the value of this sort of thing. If it's meant mostly as a novelty, a "because I could" type thing, then that's always fun, but I get the impression that people would use this for other purposes. Yes, Ruby is a charming language, but I don't really see what it offers in this context that Javascript doesn't. Are there some crazy metaprogramming techniques that can be done in Ruby to reduce code size that wouldn't work in JS? Do people really hate the idea of having to use more than one language in different layers of an application? I could see the desire to compile something very different into JS (e.g., a static-typed language), but Ruby and JS seem similar enough that I'm just not getting it.
- tolmasky 17y agoThere are a large number of Ruby libraries that I would want to be able to use in JavaScript. In fact, after I saw this I immediately tried it on a few (unfortunately this project is not far enough along to be able to handle some of them yet). Of course anything can be written in any language, the value of a project like this to me is that it is quite unfortunate that there exist pieces of functionality that are walled off in the gardens of language choice. In that respect, the fact that JS and Ruby are so similar makes the project even more worthwhile.
- jmonegro 17y agoI'm guessing that by handing over some of your tasks to javascript, you can reduce server load because javascript is a client-side language. Also to quote from the Red github link, "What does this mean for today’s Ruby developer? Simple. You don’t need to learn JavaScript."
- thwarted 17y agoOh, the burden of learning and increasing your marketability.