Worlds: controlling the scope of side effects

  • Authors:
  • Alessandro Warth;Yoshiki Ohshima;Ted Kaehler;Alan Kay

  • Affiliations:
  • Viewpoints Research Institute, Glendale, CA;Viewpoints Research Institute, Glendale, CA;Viewpoints Research Institute, Glendale, CA;Viewpoints Research Institute, Glendale, CA

  • Venue:
  • Proceedings of the 25th European conference on Object-oriented programming
  • Year:
  • 2011

Quantified Score

Hi-index 0.00

Visualization

Abstract

The state of an imperative program--e.g., the values stored in global and local variables, arrays, and objects' instance variables--changes as its statements are executed. These changes, or side effects, are visible globally: when one part of the program modifies an object, every other part that holds a reference to the same object (either directly or indirectly) is also affected. This paper introduces worlds, a language construct that reifies the notion of program state and enables programmers to control the scope of side effects. We investigate this idea by extending both JavaScript and Squeak Smalltalk with support for worlds, provide examples of some of the interesting idioms this construct makes possible, and formalize the semantics of property/field lookup in the presence of worlds. We also describe an efficient implementation strategy (used in our Squeak-based prototype), and illustrate the practical benefits of worlds with two case studies.