We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

Let’s embrace WebAssembly!

Formale Metadaten

Titel
Let’s embrace WebAssembly!
Serientitel
Anzahl der Teile
132
Autor
Lizenz
CC-Namensnennung - keine kommerzielle Nutzung - Weitergabe unter gleichen Bedingungen 3.0 Unported:
Sie dürfen das Werk bzw. den Inhalt zu jedem legalen und nicht-kommerziellen Zweck nutzen, verändern und in unveränderter oder veränderter Form vervielfältigen, verbreiten und öffentlich zugänglich machen, sofern Sie den Namen des Autors/Rechteinhabers in der von ihm festgelegten Weise nennen und das Werk bzw. diesen Inhalt auch in veränderter Form nur unter den Bedingungen dieser Lizenz weitergeben
Identifikatoren
Herausgeber
Erscheinungsjahr
Sprache

Inhaltliche Metadaten

Fachgebiet
Genre
Abstract
WebAssembly (WASM) is an open, low level binary format designed to be compact and run at native speed, while being memory-safe. WASM is primarily intended to run code in browsers, but its by no means limited to this. This makes it an interesting intermediate language (IR); code that compiles to WASM will (in the future) run basically anywhere. In short: WASM is coming and its great! Unsurprisingly, WASM is being embraced by many communities, such as C++, Rust, Lua, and .NET. Sadly, there does not seem to be a lot of enthusiasm from the Python community yet… Perhaps this is because Python is interpreted and can therefore not (easily) use WASM as a compilation target. It should be possible to compile a Python interpreter (like CPython or Pypy) to WASM and thereby run Python code in a browser. But the result would be pretty heavy-weight, so it would arguably not be a very practical. Within the PPCI project (a pure Python compiler infrastructure) tooling has been developed to load, inspect, compile and even run WASM modules. This allows combining WASM and Python in new ways. In this talk we discuss two approaches by which the Python community might embrace WASM. Firstly, various projects already exist that compile Python functions to other languages (e.g. Numba, PScript), and we have type annotations. If Python functions would be compiled to WASM, the resulting code would run in any WASM runtime (e.g. the browser). This will be demonstrated with an example, for which the resulting code can be run either in a browser or inside Python itself. In either case, it’s pretty darn fast. Secondly, rather than em using /em WASM, it might be interesting for Python to function as a platform to em run /em and em bind /em WASM modules. Two of Python’s greater strengths are its rich ecosystem and its ability to glue things together. Let’s build on that! Imagine creating an application that consists of multiple WASM modules, perhaps compiled from different languages, and binding these together into a single Python app. This will be demonstrated with a game, which is written in Rust, compiled to WASM, and running inside a Python process. The WASM module consumes a drawing API, which is in this case provided by Python, and Python feeds the WASM module with user input. I hope that this talk inspires other Pythonistas to think about the advantages that WASM can bring to our ecosystem, and also about the role that Python can play in the growing WASM ecosystem.