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. © 2011 Springer-Verlag Berlin Heidelberg.
CITATION STYLE
Warth, A., Ohshima, Y., Kaehler, T., & Kay, A. (2011). Worlds: Controlling the scope of side effects. In Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics) (Vol. 6813 LNCS, pp. 179–203). https://doi.org/10.1007/978-3-642-22655-7_9
Mendeley helps you to discover research relevant for your work.