Read-Only Execution for Dynamic Languages

  • Jean-Baptiste Arnaud
  • Marcus Denker
  • Stéphane Ducasse
  • Damien Pollet
  • Alexandre Bergel
  • Mathieu Suen
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6141)


Supporting read-only and side effect free execution has been the focus of a large body of work in the area of statically typed programming languages. Read-onlyness in dynamically typed languages is difficult to achieve because of the absence of a type checking phase and the support of an open-world assumption in which code can be constantly added and modified. To address this issue, we propose Dynamic Read-Only references (DRO) that provide a view on an object where this object and its object graph are protected from modification. The read-only view dynamically propagates to aggregated objects, without changing the object graph itself; it acts as a read-only view of complex data structures, without making them read-only globally. We implement dynamic read-only references by using smart object proxies that lazily propagate the read-only view, following the object graph and driven by control flow and applied them to realize side-effect free assertions.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Meyer, B.: Applying design by contract. IEEE Computer (Special Issue on Inheritance & Classification) 25(10), 40–52 (1992)Google Scholar
  2. 2.
    Finifter, M., Mettler, A., Sastry, N., Wagner, D.: Verifiable functional purity in java. In: Proceedings of CCS’08, pp. 27–31 (2008)Google Scholar
  3. 3.
    Donald, G., James, N.: Dynamic ownership in a dynamic language. In: Costanza, P., Hirschfeld, R. (eds.) Proceedings of the 2007 Symposium on Dynamic Languages, DLS 2007, pp. 41–52. ACM, New York (2007)Google Scholar
  4. 4.
    Hogg, J.: Islands: aliasing protection in object-oriented languages. In: Proceedings of the 6th Annual Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA’91), pp. 271–285 (1991)Google Scholar
  5. 5.
    Almeida, P.S.: Balloon types: Controlling sharing of state in data types. In: Aksit, M., Matsuoka, S. (eds.) ECOOP 1997. LNCS, vol. 1241, pp. 32–59. Springer, Heidelberg (1997)CrossRefGoogle Scholar
  6. 6.
    Clarke, D.G., Potter, J.M., Noble, J.: Ownership types for flexible alias protection. In: Proceedings OOPSLA ’98, pp. 48–64. ACM Press, New York (1998)CrossRefGoogle Scholar
  7. 7.
    Boyland, J., Noble, J., Retert, W.: Capabilities for sharing, a generalisation of uniqueness and read-only. In: Knudsen, J.L. (ed.) ECOOP 2001. LNCS, vol. 2072, p. 2. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  8. 8.
    Noble, J., Vitek, J., Potter, J.: Flexible alias protection. In: Jul, E. (ed.) ECOOP 1998. LNCS, vol. 1445, pp. 158–185. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  9. 9.
    Noble, J., Clarke, D., Potter, J.: Object ownership for dynamic alias protection. In: Proceedings TOOLS ’99, November 1999, pp. 176–187 (1999)Google Scholar
  10. 10.
    Hakonen, H., Leppänen, V., Raita, T., Salakoski, T., Teuhola, J.: Improving object integrity and preventing side effects via deeply immutable references. In: Fenno-Ugric Symposium on Software Technology, pp. 139–150 (1999)Google Scholar
  11. 11.
    Miller, M.S., Shapiro, J.S.: Paradigm regained: Abstraction mechanisms for access control. In: Proceedings of the Eigth Asian Computing Science Conference, pp. 224–242 (2003)Google Scholar
  12. 12.
    Fong, P.W.L., Zhang, C.: Capabilities as alias control: Secure cooperation in dynamically extensible systems. Technical report, Department of Computer Science, University of Regina (2004)Google Scholar
  13. 13.
    Miller, M.S.: Robust Composition: Towards a Unified Approach to Access Control and Concurrency Control. PhD thesis, Johns Hopkins University, Baltimore, Maryland, USA (May 2006)Google Scholar
  14. 14.
    Birka, A., Ernst, M.D.: A practical type system and language for reference immutability. In: Proceedings of OOPSLA’2004, pp. 35–49 (2004)Google Scholar
  15. 15.
    Schärli, N., Ducasse, S., Nierstrasz, O., Wuyts, R.: Composable encapsulation policies. In: Odersky, M. (ed.) ECOOP 2004. LNCS, vol. 3086, pp. 26–50. Springer, Heidelberg (2004)Google Scholar
  16. 16.
    Schärli, N., Black, A.P., Ducasse, S.: Object-oriented encapsulation for dynamically typed languages. In: Proceedings of 18th International Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA’04), October 2004, pp. 130–149 (2004)Google Scholar
  17. 17.
    Bergel, A., Ducasse, S., Nierstrasz, O., Wuyts, R.: Stateful traits and their formalization. Journal of Computer Languages, Systems and Structures 34(2-3), 83–108 (2008)CrossRefGoogle Scholar
  18. 18.
    Friedman, D.P., Wand, M.: Reification: Reflection without metaphysics. In: LFP ’84: Proceedings of the 1984 ACM Symposium on LISP and functional programming, pp. 348–355. ACM, New York (1984)CrossRefGoogle Scholar
  19. 19.
    Lienhard, A.: Dynamic Object Flow Analysis. Phd thesis, University of Bern (2008)Google Scholar
  20. 20.
    Haupt, M., Schippers, H.: A machine model for aspect-oriented programming. In: Ernst, E. (ed.) ECOOP 2007. LNCS, vol. 4609, pp. 501–524. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  21. 21.
    Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns: Elements of Reusable Object-Oriented Software. Addison Wesley, Reading (1995)Google Scholar
  22. 22.
    Pascoe, G.A.: Encapsulators: A new software paradigm in Smalltalk-80. In: Proceedings OOPSLA ’86, ACM SIGPLAN Notices, November 1986, vol. 21, pp. 341–346 (1986)Google Scholar
  23. 23.
    Flatt, M., Krishnamurthi, S., Felleisen, M.: A programmer’s reduction semantics for classes and mixins. Technical Report TR 97-293, Rice University (1999)Google Scholar
  24. 24.
    Denker, M., Ducasse, S., Tanter, É.: Runtime bytecode transformation for Smalltalk. Journal of Computer Languages, Systems and Structures 32(2-3), 125–139 (2006)MATHCrossRefGoogle Scholar
  25. 25.
    Ducasse, S.: Evaluating message passing control techniques in Smalltalk. Journal of Object-Oriented Programming (JOOP) 12(6), 39–44 (1999)Google Scholar
  26. 26.
    Hirschfeld, R., Costanza, P., Nierstrasz, O.: Context-oriented programming. Journal of Object Technology 7(3) (March 2008)Google Scholar
  27. 27.
    Denker, M., Suen, M., Ducasse, S.: The meta in meta-object architectures. In: Proceedings of TOOLS EUROPE 2008. LNBIP, vol. 11, pp. 218–237. Springer, Heidelberg (2008)Google Scholar
  28. 28.
    Ierusalimschy, R., de la Rocque Rodriguez, N.: Side-effect free functions in object-oriented languages. Computer Languages 3/4(21), 129–146 (1995)CrossRefGoogle Scholar
  29. 29.
    Costanza, P., Hirschfeld, R.: Language constructs for context-oriented programming: An overview of ContextL. In: Proceedings of the Dynamic Languages Symposium (DLS) ’05, co-organized with OOPSLA’05, October 2005, pp. 1–10. ACM, New York (2005)CrossRefGoogle Scholar
  30. 30.
    Warth, A., Kay, A.: Worlds: Controlling the scope of side effects. Technical Report RN-2008-001, Viewpoints Research (2008)Google Scholar
  31. 31.
    Tanter, É.: Contextual values. In: Proceedings of the 4th ACM Dynamic Languages Symposium (DLS 2008), Paphos, Cyprus, July 2008. ACM Press, New York (to appear, 2008)Google Scholar
  32. 32.
    Hanenberg, S., Hirschfeld, R., Unland, R.: Morphing aspects: incompletely woven aspects and continuous weaving. In: AOSD ’04: Proceedings of the 3rd international conference on Aspect-oriented software development, pp. 46–55. ACM, New York (2004)CrossRefGoogle Scholar
  33. 33.
    Schippers, H., Janssens, D., Haupt, M., Hirschfeld, R.: Delegation-based semantics for modularizing crosscutting concerns. In: OOPSLA ’08: Proceedings of the 23rd ACM SIGPLAN conference on Object oriented programming systems languages and applications, pp. 525–542. ACM, New York (2008)CrossRefGoogle Scholar
  34. 34.
    Flatt, M., Krishnamurthi, S., Felleisen, M.: Classes and mixins. In: Proceedings of the 25th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 171–183. ACM Press, New York (1998)CrossRefGoogle Scholar
  35. 35.
    Felleisen, M., Hieb, R.: The revised report on the syntactic theories of sequential control and state. Theor. Comput. Sci. 103(2), 235–271 (1992)MATHCrossRefMathSciNetGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2010

Authors and Affiliations

  • Jean-Baptiste Arnaud
    • 1
  • Marcus Denker
    • 1
  • Stéphane Ducasse
    • 1
  • Damien Pollet
    • 1
  • Alexandre Bergel
    • 2
  • Mathieu Suen
    • 1
  1. 1.INRIA Lille Nord Europe - CNRS UMR 8022University of Lille (USTL) 
  2. 2.PLEIAD Lab, Department of Computer Science (DCC)University of ChileSantiagoChile

Personalised recommendations