Live data from Hacker News

Why we need Python in the Browser

archlinux.me

41–50 of 132 posts

Re: Why we need Python in the Browser

#41
post #28

Earlier quoted context omitted.

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

Come on now, that's a bit harsh. There are really smart people who have been trying this exact thing for years without success. Microsoft tried harder than anyone to make "JScript" part of .NET but finally gave up and Windows 8 has 2 first-class VMs.

Without success because people like you have been fighting them every step of the way trying to hold back progress. It's hard to overcome inertia, and it's almost impossible when there is an organized resistance. It becomes absolutely insanity-inducing when said resistance uses its own success in warding off progress as ammunition for holding back progress.

I'd say I was exceedingly un-harsh, even downright polite, considering the long-term damage that has been inflicted.

Re: Why we need Python in the Browser

#42
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 languages that are arguably more expressive than it.

The problem is right now, only browser makers get to decide what languages run in the browser. Browser makers have their own concerns, and supporting new languages hasn't been historically among them.

What would be nice to aim for is a model where browsers can support multiple language runtimes. Instead of the browser makers being the ones to support a language, that language's advocates would be responsible for the port - and I suspect the competition and cooperation would make them stronger.

Ideally, the language runtimes would be installed transparently. That's the big potential of a project like Native Client - if it lives up to its billing, it makes downloading the latest version of a language runtime to a browser safe, while giving near-native speed and abstract machine.

This would let Python, Ruby, Haskell, Scala, Closure, Java, non-legacy Javascript, and more exist in the same browser, giving the web platform the same diversity of languages as is available on the desktop.

(Mobile platforms seem to also have this problem. The recent move from general-purpose to language-specific platforms is sub-optimal.)

Re: Why we need Python in the Browser

#43

Earlier quoted context omitted.

Someone has already achieved Clojure. https://github.com/clojure/clojurescript

When they mean "X in the browser", it's being natively supported. Python-to-JS exists too: http://pyjs.org/

I'm a bit unclear, but I think they mostly mean "bytecode in the browser".

Re: Why we need Python in the Browser

#44
post #24

Earlier quoted context omitted.

Lots of essential Python features are not part of the language, but belong to its standard library. The thing that makes JavaScript so portable is that it basically has no such thing (except maybe Date and Math). So to make convenient use of Python in the browser (or even to be able to run currently existing Python code), you wouldn't just have to embed the interpreter – you would have to ship this huge library. And…

You also would not be able to minify it properly because of whitespace identation constraints. Or am I off on this?

You can compact a lot of whitespace out of python.

$ cat hello.py

    def helloooo():
        print "helloooo"
        print "SLAM!"
    
    helloooo()
$ cat hellomin.py

    def helloooo(): print "helloooo"; print "SLAM!"
    helloooo()

Re: Why we need Python in the Browser

#45
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…

Doesn't dart actually do type checking? It's been a month or 2 since I played with it, but I could swear that it did type checking and reported errors when the type was wrong.

Re: Why we need Python in the Browser

#46
post #22
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.

So Python is a scripting language and not a "real programming language"? - What a stupid comment. Python is a full and mature programming language, lots of software you probably use every day is written in it, like dropbox, calibre, miro or websites like Reddit and YouTube for example. You'll find a longer list here: http://en.wikipedia.org/wiki/List_of_Python_software Sure you can use Python for scripting, but that…

    $ (cd /usr/bin; file *) |grep -i "python script"

Re: Why we need Python in the Browser

#48
post #14

Earlier quoted context omitted.

We do have that VM. It just happens that this VM's "bytecode" looks like JavaScript. Here is Python running in the browser: http://syntensity.com/static/python.html

Sorry, but this is not good enough. This argument is made all the time, but all you're really saying is that every other language should be a second-class citizen to JavaScript. Emscripten is a cool technical hack, but why the fuck is it 2012 and we have to compile C++ to JavaScript?

It's not good enough now, probably because JavaScript was designed as a lightweight scripting language to make web pages a little more interactive and not as a general "bytecode for the web".

However, it always amazes me when people in discussions like this take JavaScript as a done deal or a static target...this is a fatal flaw in this discussion.

JavaScript as a language and community has evolved a lot, and it continues to evolve. We've already seen improvements that make it a better target for compilation, and we'll be seeing more in the future...now that it's clear that that is what the web wants/needs and not just a little scripting language for forms.

My bet is it will be much easier/quicker to work JavaScript into a good target for compiling other languages to than to develop a general VM and convince all the browser vendors to adopt it.

That's not even taking into account which would be better overall, which I think is an interesting question without an entirely clear answer....but I'm a pragmatist and so I think it's not worth worrying about except intellectually.

Re: Why we need Python in the Browser

#49
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…

I also prefer typed languages. I also don't like, the way classes are implemented in Python (the whole self thing). But I think Python has enough good stuff to make up for it. To a degree this is psychological, if you only focus on the bad stuff, you will end up hating every programming language you work with.

Re: Why we need Python in the Browser

#50
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.

(with-devils-advocacy A Real Programming Language is one that can be used (and has been used) to implement its own compiler or interpreter ) That said, by this definition Python qualifies.
Post reply on HN