Static Typing and JavaScript Libraries: Towards a More Considerate Relationship
Résumé
In this paper, after relating a short history of the mostly unhappy relationship between static typing and JavaScript (JS), we explain a new attempt at conciliating them which is more respectful of both worlds than other approaches. As an example, we present Onyo [1], an advanced binding of the Enyo JS library for the OCaml language. Onyo exploits the expressiveness of OCaml’s type system to properly encode the structure of the library, preserving its design while statically checking that it is used correctly, and without introducing runtime overhead.