Live data from Hacker News

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

stackoverflow.com

31–40 of 144 posts

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

#31
post #18

Earlier quoted context omitted.

Mozilla is not against a bytecode VM. Mozilla (and the WebKit team minus Google) is against arbitrarily adding new language VMs because they create a major compatibility burden. Remember this: 1) JavaScript is locked in. It's too entrenched, it's never going away. Let's just accept that. 2) That means that adding additional languages creates a burden. You're now supporting, at minimum 2 VMs. If you're going to suppor…

Why 2 VMs? Can't you compile JavaScript to the imaginary bytecode and have a single unified VM to run them all?

In the same vein, why a VM at all? Can't you just compile Python to JavaScript?

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

#32
post #27

If Python uses indentation rather than curly braces or keywords, then it would not allow for minimization or obfuscation when used in the browser. This is the main reason IMO Google chose to design Dart with curly braces.

Playing the devil's advocate, if the browser just had a VM and ran bytecode, the syntax wouldn't matter.

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

#33
post #20

The other way to put this question is - Is there sufficient reason/motivation to try to replace Javascript with something else? What does JS lack or what are its limitations?

Proper tail-calls! Of course, I think neither Python nor Ruby support them either, but one can dream...

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

#34
post #27

If Python uses indentation rather than curly braces or keywords, then it would not allow for minimization or obfuscation when used in the browser. This is the main reason IMO Google chose to design Dart with curly braces.

gzip will negate a great deal of that advantage.

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

#35

"closed as off topic by casperOne♦ 8 mins ago" ... The number of programming topics I have had closed on that site angers me. They are becoming Wikipedia.

I'm also annoyed by the overly eager closing, but in this case I think it's justified: it's a relatively argumentative question with no real answer. The goal behind StackOverflow is to be something vaguely like interactive documentation for all of programming, so something like this doesn't really fit in. I imagine it might fit better with a site like programmers.stackexchange.com.

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

#36
post #17

Earlier quoted context omitted.

Mozilla is not against a bytecode VM. Mozilla (and the WebKit team minus Google) is against arbitrarily adding new language VMs because they create a major compatibility burden. Remember this: 1) JavaScript is locked in. It's too entrenched, it's never going away. Let's just accept that. 2) That means that adding additional languages creates a burden. You're now supporting, at minimum 2 VMs. If you're going to suppor…

> JavaScript is locked in. It's too entrenched, it's never going away. Let's just accept that. JavaScript doesn't have to go anywhere, it can run on a shared VM like any other language. > That means that adding additional languages creates a burden. You're now supporting, at minimum 2 VMs. If you're going to support a second VM you better get it positively right. That doesn't proclude doing it, it just means it's not…

> 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 resistance, while at the same time strongly favoring JavaScript as the one option.

>The position more seems to be "we might chip in if someone else comes up with the perfect answer" rather than "yes, this is a problem that needs to be solved to improve developer productivity, application quality, and help the web compete with other platforms".

I read the mailing list and that's not the impression I get at all. The impression I get is:

1) JavaScript still has a lot of room for improvement. Putting resources in an alternative (whatever shape that might take) distracts from improving JavaScript.

2) Most of the problems people have with JavaScript are being addressed by EmcaScript.next.

3) For those who have a general syntax/style problem, there are numerous alternatives that compile to JS to choose from, and more are likely to become popular in future as programmers from different backgrounds are compelled to write for the browser.

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

#37
post #8

The top comment states that any other options are impossible: "At this point we must concentrate on improving the language." I can't stand this willfully defeatist attitude. It's also not restricted to stack-overflow participants -- this position is pervasive at Mozilla. 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 ? Can you imagine if…

> Why can't we have a standardized generic bytecode and VMs to run it?

And why stop there! There are plenty of "languages" that currently compile into HTML and CSS (like HAML and SASS for example). If we have a common VM for scripting then why not a common VM for HTML and CSS as well. Heck, we could do this all with a single VM and a common API. For backwards compatibility, we could use a new HTML tag to enable this VM. Furthermore, as a proof of concept, you could design a plugin for all the major browsers that implements this.

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

#38
post #20

The other way to put this question is - Is there sufficient reason/motivation to try to replace Javascript with something else? What does JS lack or what are its limitations?

The lack of keyword default arguments drives me nuts, python just does it so well. Not to mention ===, etc, etc.

None of these things are a showstoppers, but rather amount to "death by paper cut" that in my mind that make the language unsatisfying to use.

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

#39
post #14

Earlier quoted context omitted.

If the browsers were to implement a general purpose VM, the choice of actual high-level languages would be distinct from the browser maker, and open to experimentation and competition.

I don't think it's as cut and dry as that. What if we do have a general purpose vm. Doesn't each browser still need to implement language compilers for all languages to that vm? ie what if Microsoft supports langauge foo but not language baz. Chrome supports language baz but not foo and Mozilla only supports their own proprietary language. All of which compile to the common vm. How do websites written for IE work on…

Servers could serve compiled byte code.

Someody else already mentioned that compiling python or ruby to JavaScript could be an option. We already have clojurescript which does this.

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

#40
post #8

The top comment states that any other options are impossible: "At this point we must concentrate on improving the language." I can't stand this willfully defeatist attitude. It's also not restricted to stack-overflow participants -- this position is pervasive at Mozilla. 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 ? Can you imagine if…

> 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 only a single implementation language?

Apples and oranges. On both platforms, programs rarely interact with each other and when they do, it's through the OS using a standardized API.

The web is different. One piece of code is always interacting with another piece of code, that is interacting with a third and so on. There is no standardized API. You just call the appropriate function, if available.

To implement other languages, not only would you need to compile to bytecode, add VMs, etc. you would also need to add APIs that would allow communication between different pieces of code, written by different people, in different languages. Even if implemented, which would be a nightmare, it would still stifle the very nature of the web, the very dynamism that makes web apps different.

I don't want the web to become like the desktop or mobile space. I want to pull in code from twitter, facebook, my code, etc. and have it all work together, communicate with each other, and create a dynamic environment, all on one page, client-side. This is only coming into reality now.

Post reply on HN