Hacker News new | ask | show | jobs
by lolinder 1463 days ago
To me, the groundbreaking thing about this is the idea of embedding Python in its own custom script tag instead of compiling it to WASM. Maybe other languages have done that before, but I haven't seen it.

That you have to ship the entire interpreter isn't great, but what it means for development is that there is no compilation step. You don't have to deal with the WASM toolchain directly. You write your Python code, refresh the tab, and see the results. That's a huge step up from trying to use Rust and WASM for the majority of people who aren't yet Rust developers.

Obviously it's super immature at this stage, but the future possibilities are exciting.

5 comments

Doing it inside <script type="text/python">…</script>, and having the library scan for such elements, has been a standard technique in such situations for over two decades (and for stylesheet languages, like <style type="text/less">…</style>).

Doing it inside a custom element like <py-script>…</py-script> has been done occasionally, but doesn’t work well because (a) the code is now visible in the document by default and only hidden by stylesheets, and (b) < and & now need to be escaped as &lt; and &amp;.

Great for Python developers, not so great for everyone else.

This is something I find common in the Python ecosystem. There seem to be a lot of choices made more for the benefit of the developers than the end users. Even getting a Python app with some idiosyncratic build system to run can be a challenge sometimes.

If you have to use a build system, you're not a user.
I have a vague recollection of Microsoft and/or ActiveState enabling Perl as a browser language. For a time there was an ActiveX interface for a bunch of script languages like Perl and Tcl.
It’s a great feature. Funnily enough this was a feature of the Grail web browser which actually came out a few months before the first version of Netscape with JavaScript (livescript) support
Damn, that's really cool. Too bad hype won out in the end...
Other languages have done that :)

Lua in the browser: https://fengari.io/

And then you can use that to run Fennel, a Lisp that compiles to Lua https://fennel-lang.org/

I think TypeScript also has a script you can include that lets you put your TS code in a special script tag, and it gets compiled in-browser.