ECOOP 2015
Sun 5 - Fri 10 July 2015 Prague, Czech Republic
Wed 8 Jul 2015 11:00 - 11:30 at Bohemia - Gradual Typing Chair(s): John Boyland

TreatJS is a language embedded, higher-order contract sys- tem 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 contri- butions are its guarantee of non-interfering contract execution, its sys- tematic 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 gen- erated 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 en- vironment, 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.

TreatJS, including sandboxing, is implemented and the impact of con- tracts on execution speed is evaluated using the Google Octane bench- mark.