3 ms·
Would people be interested in a Ruby-oriented project like this? Say, tiny.rb ported to use Javascript? (Some Googler already has a Lua-esque VM for tiny.rb a
by stcredzero 16y ago
Would people be interested in a Ruby-oriented project like this? Say, tiny.rb ported to use Javascript? (Some Googler already has a Lua-esque VM for tiny.rb as her 20% project.)
- jashkenas 16y agoThere are a number of existing projects that compile a partial Ruby into JS: * https://github.com/superchris/rubyjs https://github.com/superchris/rubyjs * https://github.com/jessesielaff/red https://github.com/jessesielaff/red * https://github.com/tlrobinson/cappruby https://github.com/tlrobinson/cappruby I'm afraid that Ruby semantics don't align too well with JavaScript semantics. Things as basic as numbers, method dispatch, and variable scoping don't work the same way. Either you end up with perfectly valid code written in one that doesn't run on the other, or you have an extremely slow Ruby interpreter implemented on top of JavaScript. This is the main reason why CoffeeScript tries to stick as close to JavaScript as possible.
- stcredzero 16y agoPerfectly valid code that runs in one and not the other is fine, so long as context switching can be minimized between browser and server. (It's still a switch, but smaller.)