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.
Access provided by Autonomous University of Puebla. Download to read the full chapter text
Chapter PDF
Similar content being viewed by others
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
References
Balzer, R.M.: EXDAMS—EXtendable debugging and monitoring system. AFIPS Spring Joint Computer Conference 34, 567–580 (1969)
Bergel, A., Ducasse, S., Nierstrasz, O.: Classbox/J: Controlling the scope of change in Java. In: OOPSLA 2005: Proceedings of 20th International Conference on Object-Oriented Programming, Systems, Languages, and Applications, pp. 177–189. ACM Press, New York (2005)
Bergel, A., Ducasse, S., Wuyts, R.: Classboxes: A minimal module model supporting local rebinding. In: Böszörményi, L., Schojer, P. (eds.) JMLC 2003. LNCS, vol. 2789, pp. 122–131. Springer, Heidelberg (2003)
Bracha, G.: Monkey Patching (blog post) (2008), http://gbracha.blogspot.com/2008/03/monkey-patching.html
Burckhardt, S., Baldassion, A., Leijen, D.: Concurrent programming with revisions and isolation types. In: OOPSLA 2010 (October 2010)
Clifton, C., Millstein, T., Leavens, G.T., Chambers, C.: MultiJava: Design rationale, compiler implementation, and applications. ACM Transactions on Programming Languages and Systems 28(3) (May 2006)
Denker, M., Gîrba, T., Lienhard, A., Nierstrasz, O., Renggli, L., Zumkehr, P.: Encapsulating and exploiting change with changeboxes. In: ICDL 2007: Proceedings of the 2007 International Conference on Dynamic Languages, pp. 25–49. ACM Press, New York (2007)
Ducasse, S., Lienhard, A., Renggli, L.: Seaside: A flexible environment for building dynamic web applications. IEEE Software 24(5), 56–63 (2007)
ECMA International. ECMA-262: ECMAScript Language Specification. European Association for Standardizing Information and Communication Systems, Geneva, Switzerland, third edition (December 1999)
Feldman, S.I., Brown, C.B.: IGOR: a system for program debugging via reversible execution. ACM SIGPLAN Notices 24(1), 112–123 (1989)
Ford, B.: Packrat parsing: simple, powerful, lazy, linear time, functional pearl. In: ICFP 2002: Proceedings of the seventh ACM SIGPLAN International Conference on Functional Programming, pp. 36–47. ACM Press, New York (2002)
Ford, B.: Parsing expression grammars: a recognition-based syntactic foundation. In: POPL 2004: Proceedings of the 31st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 111–122. ACM Press, New York (2004)
Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns. Addison-Wesley Professional, Reading (1995)
Hårris, T., Marlow, S., Peyton-Jones, S., Herlihy, M.: Composable memory transactions. In: PPoPP 2005: Proceedings of the tenth ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, pp. 48–60. ACM Press, New York (2005)
Hirschfeld, R., Costanza, P., Nierstrasz, O.: Context-Oriented Programming. Journal of Object Technology (JOT) 7(3), 125–151 (2008)
Ingalls, D., Kaehler, T., Maloney, J., Wallace, S., Kay, A.: Back to the future: the story of Squeak, a practical Smalltalk written in itself. SIGPLAN Notices 32(10), 318–326 (1997)
Jefferson, D.R.: Virtual time. ACM Transactions on Programming Languages and Systems 7(3), 404–425 (1985)
Johnson, G.F., Duggan, D.: Stores and partial continuations as first-class objects in a language and its environment. In: POPL19’88: Proceedings of the 15th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 158–168. ACM Press, New York (1988)
Kay, A., Ingalls, D., Ohshima, Y., Piumarta, I., Raab, A.: Proposal to NSF (2006), http://www.vpri.org/pdf/NSF_prop_RN-2006-002.pdf (granted on August 31, 2006)
Kay, A., Piumarta, I., Rose, K., Ingalls, D., Amelang, D., Kaehler, T., Ohshima, Y., Thacker, C., Wallace, S., Warth, A., Yamamiya, T.: Steps toward the reinvention of programming (first year progress report) (2007), http://www.vpri.org/pdf/steps_TR-2007-008.pdf
Kung, H.T., Robinson, J.T.: On optimistic methods for concurrency control. ACM Transactions on Database Systems 6(2), 213–226 (1981)
Morrisett, J.G.: Generalizing first-class stores. In: SIPL 1993: Proceedings of the ACM SIGPLAN Workshop on State in Programming Languages, pp. 73–87 (1993)
Nandivada, V.K., Jagannathan, S.: Dynamic state restoration using versioning exceptions. Higher-Order and Symbolic Computation 19(1), 101–124 (2006)
Okasaki, C.: Purely functional data structures. Cambridge University Press, Cambridge (1999)
Reed, D.P.: Naming and synchronization in a decentralized computer system (PhD dissertation). Technical Report TR-205, Massachusetts Institute of Technology, Cambridge, MA, USA (1978)
Reed, D.P.: Designing Croquet’s TeaTime: a real-time, temporal environment for active object cooperation. In: OOPSLA 2005: Companion to the 20th annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, pp. 7–7. ACM Press, New York (2005)
Shavit, N., Touitou, D.: Software transactional memory. In: PODC 1995: Proceedings of the 12th Annual ACM Symposium on Principles of Distributed Computing, pp. 204–213 (1995)
Smith, R.B., Ungar, D.: A simple and unifying approach to subjective objects. Theor. Pract. Object Syst. 2(3), 161–178 (1996)
Tanter, E.: Contextual values. In: DLS 2008: Proceedings of the 2008 Dynamic Languages Symposium, pp. 1–10. ACM Press, New York (2008)
Warth, A.: OMeta/JS website, http://www.tinlizzie.org/ometa-js/
Warth, A.: Experimenting with Programming Languages. PhD dissertation, University of California, Los Angeles (2009)
Warth, A., Piumarta, I.: OMeta: an Object-Oriented Language for Pattern-Matching. In: OOPSLA 2007: Companion to the 22nd ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications, ACM Press, New York (2007)
Warth, A., Stanojević, M., Millstein, T.: Statically scoped object adaptation with Expanders. In: OOPSLA 2006: Proceedings of the 21st ACM SIGPLAN International Conference on Object-Oriented Programming Systems, Languages, and Applications, pp. 37–56. ACM Press, New York (2006)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2011 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Warth, A., Ohshima, Y., Kaehler, T., Kay, A. (2011). Worlds: Controlling the Scope of Side Effects. In: Mezini, M. (eds) ECOOP 2011 – Object-Oriented Programming. ECOOP 2011. Lecture Notes in Computer Science, vol 6813. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-22655-7_9
Download citation
DOI: https://doi.org/10.1007/978-3-642-22655-7_9
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-22654-0
Online ISBN: 978-3-642-22655-7
eBook Packages: Computer ScienceComputer Science (R0)