Live data from Hacker News

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

pypyjs.org

31–40 of 144 posts

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

#33
post #25
post #18

Sample code to execute some Javascript code inside PyPy.js. I couldn't find any examples. import js js.eval("console.log(\"hi!\")")

Or this: import js js.globals.console.log('hi!')

I'm loving this, my head is reeling with the glint of possibilities

    import js
    js.globals.console.log('hi!'*5)

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

#34
post #17
post #11

This is glorious. From https://github.com/rfk/pypyjs/blob/master/CONTRIBUTING.rst : > We have the following major components in the PyPy repo: >> An "emscripten" build platform definition, which teaches pypy's rpython toolchain how to compile things with emscripten: ./deps/pypy/rpython/translator/platform/emscripten_platform/. >> An rpython JIT backend that emits asmjs at runtime: ./deps/pypy/rpython/jit/backend/asmj…

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?

Since PyPy is written in (R)Python, you can just run PyPy inside the resulting interpreter, for a 1000x slowdown.

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

#35
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?

I work on a machine that has two hypervisors, one third in plan, and more abstraction layers than a lasagna software. It is still very very efficient.

It may be fast, but I doubt it's very efficient...

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

#36
post #8
post #6

Earlier quoted context omitted.

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

Quite possibly. To be honest I never looked into it.

Being a Python guy myself, the problem was never the lack of Python in the browser, it's always the lack of a Python ecosystem in the browser. If I'm going to use Python and awkwardly interface with JS, I might as well just use JS.

It makes me want to gouge my eyes out, but it's not really that hard to get productive in. CoffeeScript is even better, if you aren't averse to adding another dependency on top of everything else.

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

#38
post #23
post #9

I watched the presentation in Pycon 2015[1], and I really liked how honest/aware they are about the challenges and tradeoffs (so far, the performance it's pretty bad compared to javascript, and the download size is still an issue). At the end is answered why python can't be directly included in Firefox or other browsers(the presenter/main developer works for Mozilla) [1] https://www.youtube.com/watch?v=PiBfOFqDIAI

> 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.
Post reply on HN