Jump to Content

traits.js: Robust Object Composition and High-integrity Objects for ECMAScript 5

Tom Van Cutsem
Mark S. Miller
Plastic 2011: International Workshop on Programming Language And Systems Technologies for Internet Clients, ACM


This paper introduces traits.js, a small, portable trait composition library for Javascript. Traits are a more robust alternative to multiple inheritance and enable object composition and reuse. traits.js is motivated by two goals: first, it is an experiment in using and extending Javascript’s recently added meta-level object description format. By reusing this standard description format, traits.js can be made more interoperable with similar libraries, and even with built-in primitives. Second, traits.js makes it convenient to create “high-integrity” objects whose integrity cannot be violated by clients, an important property in the context of interaction between mutually suspicious scripts

Research Areas