TreatJS: Higher-Order Contracts for JavaScript (Artifact)

Authors Matthias Keil, Peter Thiemann

Thumbnail PDF

Artifact Description

  • Filesize: 359 kB
  • 2 pages

Document Identifiers

Author Details

Matthias Keil
Peter Thiemann

Cite AsGet BibTex

Matthias Keil and Peter Thiemann. TreatJS: Higher-Order Contracts for JavaScript (Artifact). In Special Issue of the 29th European Conference on Object-Oriented Programming (ECOOP 2015). Dagstuhl Artifacts Series (DARTS), Volume 1, Issue 1, pp. 1:1-1:2, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2015)



TreatJS is a language embedded, higher-order contract system for JavaScript which enforces contracts by run-time monitoring. Beyond providing the standard abstractions for building higher-order contracts (base, function, and object contracts), TreatJS's novel contributions are its guarantee of non-interfering contract execution, its systematic approach to blame assignment, its support for contracts in the style of union and intersection types, and its notion of a parameterized contract scope, which is the building block for composable run-time generated contracts that generalize dependent function contracts. TreatJS} is implemented as a library so that all aspects of a contract can be specified using the full JavaScript language. The library relies on JavaScript proxies to guarantee full interposition for contracts. It further exploits JavaScript's reflective features to run contracts in a sandbox environment, which guarantees that the execution of contract code does not modify the application state. No source code transformation or change in the JavaScript run-time system is required.
  • Higher-Order Contracts
  • JavaScript
  • Proxies


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads