Live data from Hacker News

Why we need Python in the Browser

archlinux.me

101–110 of 132 posts

Re: Why we need Python in the Browser

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

Once you master GWT you can really be very productive in it, while allowing you to:

-Write statically-typed code

-Maintain large projects using packages and OOP

-Use unit testing, code generation, and refactoring tools

-Use many Java libraries out-of-the-box or with minor modifications (this part I often find mind-boggling)

-Write code that works on server and client (also mind-boggling)

-Ignore the DOM, just use widgets

-Ignore the vast majority of cross-browser issues

-Get great IDE support

-Readily deploy apps in servlet containers like GAE or Elastic Beanstalk

-Get very performant, minimized production code

-Get help implementing best practices such as safehtml

-Interleave with JavaScript

Main drawbacks are that there are few well-maintained widget libraries, compiler takes forever, Google has been a bit reluctant to expand JRE emulation, and the script format is a bit annoying. Java is also not a great asynchronous language since it lacks anonymous functions. However, if slightly uglier looking code really concerns you, you probably don't have your priorities straight.

I don't really know what the point of Dart is. I suspect it is being promoted more out of legal concerns over Oracle than out of technical merit.

Re: Why we need Python in the Browser

#102

Earlier quoted context omitted.

Brendan Eich has talked about why bytecode + VM is a bad idea for a browser: http://www.aminutewithbrendan.com/pages/20101122 If you really want a VM, it already exists. It's called JavaScript, assembly language of the web. I would hate for sites to start saying, "Requires the PyJSVM v0.8 or better to function, download it now!" EDIT: in hindsight, this post was careless. I was wrong about the "PyJSVM" point, and I p…

"Requires the PyJSVM v0.8 or better to function, download it now!" WTF is that? The whole point is that you'd target the bytecode standard . This would be just like targeting javascript today, but it wouldn't require hacks to deal with the broken aspects of javascript and maybe tools like cliend-side debugging would be useful. It doesn't have anything to do with individual VMs per language.

Yes, you're right. Sorry, I was mistaken, confusing how Dart has its own VM, and how the browser has to have explicit support for said VM. (And yes, I know Dart can also compile to JS, that's not my point).

Re: Why we need Python in the Browser

#103
post #3

Source mapping (part of ES6) gives proper error messages for other languages compiled into JS, I believe this would include Pyjamas etc. But do Python programmers who haven't programmed for the browser before realize how important async is? Tornado and Twisted users are used to passing around functions, but they're very small subsets of the Python community, who, if asked to fetch something and do something with it,…

"But do Python programmers who haven't programmed for the browser before realize how important async is?"

Not a very useful question. Anyone who has ever programmed on a GUI of any sort will know how important that is, anybody else will rapidly learn. The vague-but-pervasive idea that web developers invented async about two years ago and thus "async experience" can be presumed to have not penetrated out to those other less enlightened communities who still haven't discovered its Mighty Powers is... not exactly historically accurate, let us say. GUIs have always had to deal with async issues, going all the way back to the dawn of GUIs. It's not a new idea. It's probably older than you are. (It is older than I am.)

Re: Why we need Python in the Browser

#104

Earlier quoted context omitted.

Brendan Eich has talked about why bytecode + VM is a bad idea for a browser: http://www.aminutewithbrendan.com/pages/20101122 If you really want a VM, it already exists. It's called JavaScript, assembly language of the web. I would hate for sites to start saying, "Requires the PyJSVM v0.8 or better to function, download it now!" EDIT: in hindsight, this post was careless. I was wrong about the "PyJSVM" point, and I p…

Surprise, surprise. Mr. Javascript thinks a VM for the browser would be a bad idea. Let's address his points: Viewing source is a non-sequitor: the source code could be streamed down with the bytecode. Standardizing a bytecode is no harder than standardizing a language and DOM, in fact, should be easier. Versioning bytecode is no harder than versioning languages. Bytecode does not imply an implementation any more tha…

The view source is not a non-sequitor. What would prevent a server from refusing to stream the source? It would have to be part of the VM spec that the source must be made available, and that seems unlikely.

I look at Flash, which I used to develop in (this is not meant to be a comment on Flash itself). There are amazing people out there doing amazing things, but because the source isn't right there, a blog post with code snippets is mandatory. Whereas with JS you can typically learn something even if it's obfuscated (to an extent).

Re: Why we need Python in the Browser

#105
post #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?

http://www.python.org/dev/peps/pep-3104/ describes the rationale for python's closure design.

Personally, to me Javascript is horrendously broken at what it does. In addition to being fatally underspecified as a language, the asynchronous model as implemented in JS results in callback spaghetti (or black magic with Streamline or something). Most JS evented code has extremely poor readability, since logic flow is continuously interrupted.

The best asynchronous event programming idioms I've seen in Python use decorators and yield.

  @event_handler
  def f(input):
      do_stuff()
      x = yield do_more_stuff() # asynchronous call
      return {"result": x}

Re: Why we need Python in the Browser

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

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.

Did you miss this bit of the article: "Web browsers can be viewed as a zero install interface, a virtual machine for these applications. Such a VM has no reason to be language dependent."

I don't think the article is really about Python, just thats used as an example because that's the language the author uses. I think its really about wanting a VM in the browser that any language can compile to (without having to compile to a high level language like javascript).

Re: Why we need Python in the Browser

#107
If google is serious with Dart, I'd hope they would release some library/tool that bridged python to chrome and supported the dart dom libraries.

I would think that would help make it popular which would help compel other browsers to support such technology.

Re: Why we need Python in the Browser

#108

Earlier quoted context omitted.

Of course Python is a Real Language, it exists, etc, yes. But it's not a Real Programming Language. You see, everyone using python, ruby, perl, php, and other similar platforms - we're not programming , we're just scripting . The difference is so extreme, that, well... if you don't understand, I'm not going to bother explaining.

Sorry, Poe's law kicked-in and I mistakingly downvoted you. I'm very sorry:|

Sorry too - I should have added a sarcasm tag (or, more appropriately, a sarchasm tag).

I've been doing PHP for 16 years (among other things), and have grown tired of the "scripting vs whatever" debates/comments/remarks/jibes/etc over the years. That didn't come across enough in my original post - sorry. :/

Re: Why we need Python in the Browser

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

[deleted]
Post reply on HN