Live data from Hacker News

Why don't they implement Python and Ruby on the web browsers?

stackoverflow.com

51–60 of 144 posts

Re: Why don't they implement Python and Ruby on the web browsers?

#51

Earlier quoted context omitted.

You can, sure. 2 problems: 1) It will undoubtedly be slower than the current JS-quirks optimized VMs. 2) There is a shit-ton of JS on the web that has been tested to work with the current crop of VMs, moving to a new VM almost guarantees breakage. It's the same reason why GNU Screen isn't rewritten despite (supposedly) being a mess.

You're not the first person to posit that adding a new VM "almost guarantees breakage". So what? Keep the old VM, transition to the new one by specifying that's what you're targeting, then deprecate the old VM and eventually lose it altogether. You make it sound like the computing world has never introduced a new version of a language that has implications for the older ones and managed to overcome it. Even the web d…

I'm not aware of anyone disrupting critical code the way you're suggesting. It would be akin to rewriting malloc. I'm not discounting a slow transition akin to what you suggest, but you're talking about a long time frame of supporting 2 VMs side by side. Probably 10+ years.

And even then, you still have to support JavaScript being written directly in HTML tags, something no other language could enjoy. So every browser must include a JavaScript to (new VM) bytecode compiler. JavaScript will always be in a priviledged position.

Re: Why don't they implement Python and Ruby on the web browsers?

#52
post #41

Earlier quoted context omitted.

Why arent browser UI's created using HTML, CSS and JS ?

I think the various Mozilla projects actually do have facilities for this, and that some significant portion of the chrome is done this way. Where browser UIs aren't done this way, though, I suspect it's because the APIs are for components that aren't markup based -- you write the software for the platform with the APIs it provides, or (as I believe Mozilla has done) you write your own platform on top of something el…

I think we are asking opposite questions - if web based UI's are so awesome and have no caveats attached for display based apps then why are browsers not written using HTML, CSS and JS ? I am asking this question because I know at least one person from mozilla has replied to this thread.

Re: Why don't they implement Python and Ruby on the web browsers?

#53

Earlier quoted context omitted.

Really? You're discounting all of the incredible webapps, games, and social networking on the web. If Javascript was bad for innovation, I sure don't see it. You're talking language syntax. Although it matters, it practically doesn't. People build stuff no matter what the language looks like. Look at Obj-C, that thing is horrid (syntax-wise) but look at all the developer adoption. What is bad for innovation is to mov…

> If Javascript was bad for innovation, I sure don't see it. This is a fallacy: in absence of a peek at some alternative world where something else was available, you can't tell that javascript improved or worsened the innovation rate.

It seems pretty reasonable to observe the desktop world, though, since it has the properties under discussion, and ask ourselves whether it's easier to deploy an application to a wide audience there or on the web.

Re: Why don't they implement Python and Ruby on the web browsers?

#54
post #43
post #40

Earlier quoted context omitted.

> Why can't we have a standardized generic bytecode and VMs to run it? Why should the web be locked to a single language forever? In the beginning, this was the intended design. Which is why you still specify the language when injecting code into the page. That original design is flawed and does not work well on the web. Adding other languages is a horrible idea. > Can you imagine if we had locked desktops and mobile…

The JVM and the CLR have already adequately demonstrated that multiple languages can easily (and with adequate performance) share common libraries and APIs. Mixing Scala, Java, Ruby, JS, and PHP -- all in one process -- is simple and straight-forward on the JVM. That said, the language of the web is HTTP and REST and open APIs, not injection/eval of JavaScript.

> The JVM and the CLR have already adequately demonstrated that multiple languages can easily (and with adequate performance) share common libraries and APIs.

Please tell me how code in PHP can get a response from a function in JavaScript? What if that response is a Date object? What if that Date object was extended with additional functionality? What if that Date object stored additional values in unexpected places? A huge advantage of Javascript is that everything is an object and everything can be modified.

When you try to make that work, you'll start placing restrictions on what can and what can't be passed. Global scope will be a nightmare. You'll try to hack together a scheme that casts responses into primitives. In the end, you'll end up with a stifling environment where interoperabilty is a theory that is never used in production because it was crippled to make it functional to the point of being useless.

Re: Why don't they implement Python and Ruby on the web browsers?

#56
Javascript is a perfectly reasonable underlying language. Nothing that I know of stops people from compiling python or ruby into javascript.

I would never write pure javascript, but using languages that compile to javascript has been pure joy.

See http://common-lisp.net/project/parenscript/

Re: Why don't they implement Python and Ruby on the web browsers?

#57
post #54
post #43

Earlier quoted context omitted.

The JVM and the CLR have already adequately demonstrated that multiple languages can easily (and with adequate performance) share common libraries and APIs. Mixing Scala, Java, Ruby, JS, and PHP -- all in one process -- is simple and straight-forward on the JVM. That said, the language of the web is HTTP and REST and open APIs, not injection/eval of JavaScript.

> The JVM and the CLR have already adequately demonstrated that multiple languages can easily (and with adequate performance) share common libraries and APIs. Please tell me how code in PHP can get a response from a function in JavaScript? What if that response is a Date object? What if that Date object was extended with additional functionality? What if that Date object stored additional values in unexpected places?…

Your concerns seem ill-founded given that these are solved problems. There are working implementations of low-barrier cross-language compatibility, today, for both the JVM and the CLR.

Here's one example; Rhino provides pretty seamless bridging from JavaScript to Java:

https://developer.mozilla.org/en/Scripting_Java

I've used it to run user-supplied JS inside the JVM.

PHP is pretty easy too:

http://quercus.caucho.com/quercus-3.1/doc/quercus.xtp#JavaPH...

Scala is even more lightweight here:

http://www.codecommit.com/blog/java/interop-between-java-and...

Bear in mind that these are all for the JVM, which wasn't even designed with the intention of being a general-purpose multi-language VM.

Re: Why don't they implement Python and Ruby on the web browsers?

#58
post #42

Earlier quoted context omitted.

> JavaScript doesn't have to go anywhere, it can run on a shared VM like any other language. True, but the JS VMs we have today have been refined over 15+ years and switching to another risks breaking the web in profound ways. Even Google would be against dropping V8 for JS use. >There is literally zero investment in moving such an idea forward on the part of Mozilla and WebKit (sans Google). In fact, there's active…

> True, but the JS VMs we have today have been refined over 15+ years and switching to another risks breaking the web in profound ways. Even Google would be against dropping V8 for JS use. And yet, Google, Apple, AND Mozilla have all successfully introduced entirely new or significantly refactored VMs in the past few years. This is solvable; it HAS been solved. > JavaScript still has a lot of room for improvement. Pu…

> And yet, Google, Apple, AND Mozilla have all successfully introduced entirely new or significantly refactored VMs in the past few years.

Yes, because the old VMs were critically slow. Things like DOM manipulation aren't blocking problems the way they used to be.

> This is solvable; it HAS been solved.

Why? What critical problem requires a bytecode VM? Developers refusing to write in anything but their favorite language?

> In terms of performance, debugging, profiling, and simple functionality, compiling to JS is simply a work-around, not a solution.

This is solvable without alternative VMs. WebKit is working on CoffeeScript/other language debugging: http://www.infoq.com/news/2011/08/debug-languages-on-javascr...

Re: Why don't they implement Python and Ruby on the web browsers?

#59
post #54
post #43

Earlier quoted context omitted.

The JVM and the CLR have already adequately demonstrated that multiple languages can easily (and with adequate performance) share common libraries and APIs. Mixing Scala, Java, Ruby, JS, and PHP -- all in one process -- is simple and straight-forward on the JVM. That said, the language of the web is HTTP and REST and open APIs, not injection/eval of JavaScript.

> The JVM and the CLR have already adequately demonstrated that multiple languages can easily (and with adequate performance) share common libraries and APIs. Please tell me how code in PHP can get a response from a function in JavaScript? What if that response is a Date object? What if that Date object was extended with additional functionality? What if that Date object stored additional values in unexpected places?…

This generally isn't the case with disparate languages on the JVM. Unless you have a concrete objection with a scientific basis, you're just spreading FUD, and I don't think that contributes to the conversation.

Re: Why don't they implement Python and Ruby on the web browsers?

#60
post #57
post #54

Earlier quoted context omitted.

> The JVM and the CLR have already adequately demonstrated that multiple languages can easily (and with adequate performance) share common libraries and APIs. Please tell me how code in PHP can get a response from a function in JavaScript? What if that response is a Date object? What if that Date object was extended with additional functionality? What if that Date object stored additional values in unexpected places?…

Your concerns seem ill-founded given that these are solved problems. There are working implementations of low-barrier cross-language compatibility, today, for both the JVM and the CLR. Here's one example; Rhino provides pretty seamless bridging from JavaScript to Java: https://developer.mozilla.org/en/Scripting_Java I've used it to run user-supplied JS inside the JVM. PHP is pretty easy too: http://quercus.caucho.com…

I can't speak to the JVM, but I know for a fact that some CLR languages have incompatibilities (C# and F# specifically).
Post reply on HN