Live data from Hacker News

PyPy.js: A fast, compliant Python implementation for the web

pypyjs.org

81–90 of 144 posts

Re: PyPy.js: A fast, compliant Python implementation for the web

#81
post #78
post #70

Earlier quoted context omitted.

> At the end is answered why python can't be directly included in Firefox or other browsers(the presenter/main developer works for Mozilla) Direct link to answer: https://youtu.be/PiBfOFqDIAI?t=1611

"If we ship Python inside of Firefox, no one is going to use it because it's not available in Chrome, it's not available in Internet Explorer." Oh yeah? Try me.

Well, Google more or less tried the same with Dart and has since abandoned that plan in favor of targeting JS as Dart's primary runtime. Then again, the Dart VM never shipped in mainline Chrome, so who knows how a more committed attempt would have played out.

Re: PyPy.js: A fast, compliant Python implementation for the web

#84
post #17

Earlier quoted context omitted.

Glorious indeed. At least three levels of abstraction, two JITs, and a host of supporting code. Can we add some more layers like an emulator or get recursive by getting something like Pyasm running inside it?

Potentially just one JIT, right? asm.js is AOT compiled on Firefox.

No, because it's "AOT" compiled when it's downloaded or executed (since you have one JIT, you can't AOT compile what it produces). So you can think about it as "just" one JIT, but a very inefficient one

Re: PyPy.js: A fast, compliant Python implementation for the web

#85
post #67
post #5

Earlier quoted context omitted.

it's systematically translating the PyPy interpreter to the Javascript, so it has to get semantics right. However I'm not sure if the drawbacks can be addressed in the current JS model, notably: very slow warmup, huge download size (that's primarily PyPy fault though), the lack of good JS access.

> However I'm not sure if the drawbacks can be addressed in the current JS model, notably: very slow warmup, huge download size Only for the first time loading it. It would be great if some big organization (looks at Google) hosts the "standard" version of the file, much like jquery, so that it would be cached and ready to be used on the local machine most of the time.

I believe this only addresses the download size and not the crazy warmup (you still reparse it etc.)

Re: PyPy.js: A fast, compliant Python implementation for the web

#86
post #23

Earlier quoted context omitted.

> python can't be directly included in Firefox or other browsers So Python is a bad candidate, but there are better candidates out there. For example, jsofocaml (using OCaml in the browser) looks quite promising. In the end, we need a lightweight yet properly defined and highlevel language, and the ML languages as well as the LISP languages are great candidates for that.

Purescript is a Haskell-like language that is designed to output to javascript. It looks quite nice and has seen a lot of attention lately. It's even in GSoC.

The problem I have with "output to Javascript" languages is that debugging becomes hell. Line numbers no longer correspond to each other, for example.

A slightly less-hellish but still annoying problem is that I often poke at things directly from the console when bugs happen, and this helps me a lot in debugging. However poking at the console requires using JavaScript, which is fine, but it would drive me nuts to have to code in one language (e.g. CoffeeScript, TypeScript, Python) and debug in another (JavaScript) and switch my brain back and forth every few minutes. So I've ended up largely sticking with writing code directly in JavaScript.

Any good solutions to this? Are there replacements to the Chrome JavaScript console that supports those other languages?

Re: PyPy.js: A fast, compliant Python implementation for the web

#87
post #6
post #4

So does this mean that since I'm better at Python than Javascript, I can now use this to make my web frontends in Python? Because that would be pretty sweet.

weren't you already able to do it with pyjamas/pyjs?

No, no, no!!!

Pyjamas was based on GWT, right? So, a Java Framework translated to Python. It's as nice as running a pack of deer on a road with a truck.

Awful

Re: PyPy.js: A fast, compliant Python implementation for the web

#88

Earlier quoted context omitted.

> In the end, we need a lightweight yet properly defined and highlevel language.... Even lua would be a joy!

Out of curiosity, what would make Lua valuable to add in browsers by default? It is similarly prototype-based, has the same closure design, is dynamically typed, has an object system fairly similar to JS (with the type of arrays and hashtables both mixed), and its number system is also based on floating-point numbers… I honestly don't see how we can justify the cost of adding Lua to browsers. I see the merit of Lua-t…

Lua 5.1 (2006) has lexical scoping, tail calls, multiple return vales with assignment lists, semicolons are actually optional & most importantly: coroutines. ES6 adds some of these features.

Lua 5.3 has both integer and floating-point types.

Re: PyPy.js: A fast, compliant Python implementation for the web

#89
post #86

Earlier quoted context omitted.

Purescript is a Haskell-like language that is designed to output to javascript. It looks quite nice and has seen a lot of attention lately. It's even in GSoC.

The problem I have with "output to Javascript" languages is that debugging becomes hell. Line numbers no longer correspond to each other, for example. A slightly less-hellish but still annoying problem is that I often poke at things directly from the console when bugs happen, and this helps me a lot in debugging. However poking at the console requires using JavaScript, which is fine, but it would drive me nuts to hav…

Are you using source maps? If so, you can actually put breakpoints in your other source and Chrome will still break on it. I've even done this with Scalajs.

Re: PyPy.js: A fast, compliant Python implementation for the web

#90
post #6

Earlier quoted context omitted.

weren't you already able to do it with pyjamas/pyjs?

No, no, no!!! Pyjamas was based on GWT, right? So, a Java Framework translated to Python. It's as nice as running a pack of deer on a road with a truck. Awful

Pyjamas/pyjs is actually two parts: the transpiler and accompanying widget set. Only the latter is related to GWT. The transpiler can be used independently.
Post reply on HN