Typescripten: Generating Type-safe JavaScript Bindings for emscripten – Sebastian Theophil

https://cppcon.org/
https://github.com/CppCon/CppCon2020
---
WebAssembly has become a very popular target platform for C++ developers. Thanks to emscripten, porting native applications to WebAssembly is easy — as long as the application only uses the browser as a display and input device. However, emscripten does not provide type-safe wrappers to the standard JavaScript APIs such as the DOM manipulation API, let alone any other JavaScript API provided by existing web applications.

Our open source tool “typescripten” has been built on top of three powerful technologies to close this gap. It uses TypeScript interface definition files and the TypeScript compiler API to create type-safe C++ wrappers based on emscripten. TypeScript already has interface definition files for over 7000 JavaScript libraries that you can now use safely from C++.

We strive to design our C++ wrappers such that the C++ code using them looks similar to the equivalent TypeScript or JavaScript code. However, the peculiar semantics of prototype-based Javascript and Typescript are often difficult to translate into a type-based language such as C++. I will discuss the challenges we faced and choices we made when designing this framework.

---
Sebastian Theophil

Sebastian studied Computer Science in Berlin and Toulouse, France, and holds a Ph.D. in Computer Science from the Humboldt University of Berlin. He has been working at think-cell Software since its founding in 2002. Over the years, Sebastian has worked on a lot of things at think-cell. In recent years, he was the Lead Developer porting think-cell to the Mac.

He was invited as speaker at RWTH Aachen, ETH Zürich, Freie Universität Berlin, Humboldt Universität zu Berlin, and he is also speaking in various international C++ conferences and gatherings.

---
Videos Recorded & Edited by Digital Medium: http://online.digital-medium.co.uk

The CppCon YouTube Channel Is Sponsored By:
JetBrains : http://jb.gg/cpptools
SonarSource: https://www.sonarsource.com/

Filed under: Science & Technology

No comment yet, add your voice below!


Add a Comment