Live data from Hacker News

Why we need Python in the Browser

archlinux.me

51–60 of 132 posts

Re: Why we need Python in the Browser

#53
post #28

Earlier quoted context omitted.

Browsers supporting JavaScript and some other bytecode format would bring web innovation to a crawl. I think once browsers are able to debug in the originating languages people will stop complaining about this.

Arrogant people preemptively declaring failure and trying to enforce their baseless declarations on others is what brings innovation to a crawl.

That's just shooting the messenger. The comment about 'enforcing ... on others' is completely unwarranted.

Re: Why we need Python in the Browser

#54
I like Python, but JavaScript is sort of good at what it does: evented programming. In javascript it's really easy write a closure. I have not worked with asynchronous frameworks like twisted, but I'd image it's a little more awkward. Am I wrong?

Re: Why we need Python in the Browser

#55
post #7

For some time now I've been wondering why the primary scripting format consumed by browsers is JavaScript (a language intended for humans) and not some sort of standard bytecode that would be executed in a browser's virtual machine. What we need is the JSVM! In other words, something like the JVM but adapted for the browser. That probably means it would have a more dynamic typing focus since it makes sense for JavaSc…

All of a sudden you don't need to build in Python support, or Ruby support or LISP support or whatever else you fancy into the browser. The browser no longer cares what you compiled the script from, it just gets the standard bytecode and everyone's happy.

Yes please. Just define a straightforward VM in the browser and be done with it. Let the coders handle the rest, and compile any of their favorite languages to it (they will!). Java was on the right track, too bad the implementation (and APIs) were so clunky instead of nicely integrated, otherwise we'd never have needed the JS, Flash, Silverlight, Java applets, HTML5 mess that we're in now.

Anyway, hindsight is 20/20, now we can just settle on JS as a target VM. Too bad it's implemented slightly different in every browser, making it inconvenient as intermediate format. Also, going through a dynamic language is an inefficient level of indirection if you want to program in a static language. You throw away information that could have been used to optimize.

Re: Why we need Python in the Browser

#56
post #23

Python in the browser would ultimately lead to all the same problems as Javascript in the browser. In a few years, we'll be hearing: Clojure in the browser, Scala in the browser, Haskell in the browser. I've been programming in Python full-time for the past 6 months, and it's main deficiency are the same as JavaScript's: no (optional) static typing - I'm really sick of writing checks whether my function got values of…

FYI, Dart does type checking.

If you want to give your javascript some type-checking, try running it through the closure compiler. This is what we do, and we annotate our methods with type signatures like this

  /**
   * Queries a Baz for items.
   * @param {number} groupNum Subgroup id to query.
   * @param {string|number|null} term An itemName,
   *     or itemId, or null to search everything.
   */
  goog.Baz.prototype.query = function(groupNum, term) {
    ...
  };
And then the Closure Compiler tells us if we've broken some type contracts.

Re: Why we need Python in the Browser

#57
post #20

As a user of Real Programming Languages (Common Lisp, Java, C) I'm indifferent to scripting languges, but if I had to choose ONE to see in the browser, it would be Lua. It has sane, symmetric minimal design that gets closures. It also looks like a programming language. I can type Lua into the Firebug repl and not worry about indentation.

I like how you capitalized the Real Programming Languages, as if it is some official definition. The notion that python isn't real, is just silly.

I prefer to think the Use Of Capitals to indicate Serious Business was done in the same spirit as on the defunct adequacy.org.

Re: Why we need Python in the Browser

#58

We don't need Python in the browser. We need x in the browser, where x is every language and runtime. Javascript isn't some sort of global optimum that's perfect for every possible application. The subset of Javascript that's supported by a wide range of current browsers certainly isn't. And the result is that people aiming for the web environment are limited by what Javascript can do - even though there are language…

So I'm a little ignorant, but I think I'll benefit from answers more informed people give:

My question is, why aren't people out there (who are more experienced at programming/developing than I am) developing support for X language(s) in open source web browsers like Firefox. I'm sure I don't fully understand how this works yet, but can't anyone who wants to be developing this capability independently instead of waiting for browser makers to do it?

Re: Why we need Python in the Browser

#59
This is ridiculous. I love python, but it has no language support for an event loop, and if you put it in a browser, everything would have to be done in an event loop. It'd be ugly.

Javascript excels at evented programming. Use the right tool for the job.

Re: Why we need Python in the Browser

#60
post #11
post #7

For some time now I've been wondering why the primary scripting format consumed by browsers is JavaScript (a language intended for humans) and not some sort of standard bytecode that would be executed in a browser's virtual machine. What we need is the JSVM! In other words, something like the JVM but adapted for the browser. That probably means it would have a more dynamic typing focus since it makes sense for JavaSc…

I'm sure we could have some sort of JSVM, we could even have some sort of bytecode for the HTML, but it would destroy part of what makes the web so great: it's openness. The ability to view the source of any webpage, and even make chances and enhance it locally. There is also the fact that certain optimization can only be done by the browser if it has the actual source code rather than the compiled bytecode.

[deleted]
Post reply on HN