PyPy.js: A fast, compliant Python implementation for the web
51–60 of 144 posts
Re: PyPy.js: A fast, compliant Python implementation for the web
#52Re: PyPy.js: A fast, compliant Python implementation for the web
#53Earlier 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.
Furthermore, Purescript's FFI is really nice to use and it's really easy to bind to existing javascript libraries.
PureScript is community is nice and active. They are also discussing a lot with the `virtual-dom` guys to bring react/om/mercury-like functionality to purescript [0] and it's quite freakin awesome.
Seriously I'd take purescript for javascript any day. I think it's great that we FP folks can finally do frontend dev :-)
Re: PyPy.js: A fast, compliant Python implementation for the web
#54This 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…
Re: PyPy.js: A fast, compliant Python implementation for the web
#55This 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…
By the way, is RPython a nice language to program in?
Re: PyPy.js: A fast, compliant Python implementation for the web
#56[0] - http://opalrb.org
Re: PyPy.js: A fast, compliant Python implementation for the web
#57Is there a Python 3 version of this?
Re: PyPy.js: A fast, compliant Python implementation for the web
#58I 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.
Even lua would be a joy!
Re: PyPy.js: A fast, compliant Python implementation for the web
#59Sample code to execute some Javascript code inside PyPy.js. I couldn't find any examples. import js js.eval("console.log(\"hi!\")")
Just playing around: import js c = js.globals.document.createElement("canvas") js.globals.document.body.appendChild(c) ctx = c.getContext("2d") ctx.fillRect(10, 10, 10, 10) Edit: Here is a simple animation: import js import math import time c = js.globals.document.createElement("canvas") js.globals.document.body.appendChild(c) ctx = c.getContext("2d") def render(): ctx.clearRect(0, 0, c.width, c.height) t = time.time…
>>> import js
... c = js.globals.document.createElement("canvas")
...
debug: OperationError:
debug: operror-type: SyntaxError
debug: operror-value: ('EOL while scanning string literal', ('c callback', 1, 12, "r = c.push('import js\n", 0))
debug: OperationError:
debug: operror-type: KeyError
debug: operror-value: 'r'
And then the input window hangs. Strangely enough, if I type it in instead, it's okay.(ChromeOS v43 beta-channel)
Re: PyPy.js: A fast, compliant Python implementation for the web
#60This 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…
Since PyPy compiles RPython to C, couldn't one write a web app in RPython, compile it to C, then to JS (with asm.js) and enjoy a quick page load and smaller file size? By the way, is RPython a nice language to program in?