Hacker News new | ask | show | jobs
by marcamillion 4765 days ago
I love this. I wish someone would do this for Ruby.

Not CoffeeScript - I want to be able to write Ruby that manipulates DOM objects.

3 comments

Last time i checked it, it contained links to old/dead projects, which seems still the case. Anyway AFAIK there is no such a similar thing to Brython for ruby, and by that I mean a ruby implementation specifically written in JS and optimized to deal with DOM and browser environment in general (if anybody knows about something like that or is working on it please inform me). It'd be such a great thing to have!
opal is very much still alive: http://opalrb.org

Most of the work in the recent weeks has been improving the ruby <=> js bridge so that calling js methods/functions from ruby is possible.

Thanks. Btw, I have nothing against Coffeescript per se. I just prefer Ruby :)
You can do it while following a similar approach to what is done for PythonScript, it's easy. PythonScript is compiled to Javascript, it use the Python abstract syntax tree module to parse python code then generate javascript. The subset of python that is (directly) translated to Javascript is PythonJS. With PythonJS is implemented some runtime stuff and higher level construct of Python. http://apppyjs.appspot.com/ Sorry the editor is broken.
I dream of a day where I can choose what language to script a page in, using a native implementation, rather than being forced to use javascript.

Javascript is great, but I'd rather work in Python and have it be actual Python, not an interpreter written in an interpreted language.

Apologies for going off-topic, but why ISN'T that an option now? Was that not the point of "type" in <script> in the first place? (That's a genuine question; I don't know the history of the <script> tag, or its "type" attribute.

How is V8 wired into Chrome, or Rhino(?) into Firefox, for example? Is there a great technical barrier to making it possible for the user to install an interpreter of their choice? As I understand the course of the browser's history, it already seems to be moving to an OS-style program (or, in Chrome's case, it has BECOME an OS), so it seems like user-loaded language runtimes OUGHT to be on SOMEONE'S mind. And I'd be surprised if it hasn't already occurred to someone before, I just don't know the history.

Has anyone attempted to write a browser that allowed for such a thing? Or has JS just been the accepted scripting language, and no one has yet tried to push past?

IIRC, Microsoft tried to get vbscript to catch on, but it didn't. I think it was a case of one language doing the trick adequately, and adding more would just multiply the headaches for development and building cross-browser compatible code. What happens when Firefox supports Python 3, Microsoft supports Python 2 (but not actual python 2, their own proprietary version) and Opera just happens to only ever run javascript?