The state of an imperative program-e.g., the values stored in global and local variables, objects' instance variables, and arrays-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 as an extension of JavaScript, and provide examples that illustrate some of the interesting idioms that it makes possible.
Warth et al. REF introduces Worlds, a language construct that reifies the notion of program state and enables programmers to control the scope of side effects.
Worlds: Controlling the scope of side effects
Computer Science