{Java,Py}Script

May 2, 2022

There was a project announced this week that lets you write python scripts in HTML and have them execute in the browser (pyscript). Here's an example.

  <body>
    Hello world! <br>
    This is the current date and time, as computed by Python:
    <py-script>
from datetime import datetime
now = datetime.now()
now.strftime("%m/%d/%Y, %H:%M:%S")
    </py-script>

Under the covers, this uses pyodide and WebAssembly. This is one reason why I'm more excited about clientside WASM.

Browser ended up with high-performance JavaScript by Path Dependence. It was designed in 10 days, with a name similar to Java as a marketing ploy.

But what language will become the new lingua franca of the web?

It's no longer necessary to have a just-in-time compiled scripting language. Instead, you can ship binary blobs compiled down to WebAssembly from various languages.

This is special because it opens up an alternative to the mess that is webpack. How easy it is to share, import, and reuse code might be one of the essential properties of language adoption. But unfortunately, JavaScript's import systems have been bolted onto the web. Now, the alternative is statically-linked WebAssembly binaries.

Python in the browser has passed the prototype phase but will need a "compiled" form (If it can be compiled, it will be). Either some format like the PAR file or a webpack-like bundler system.