Skip to main content

The Billion-Dollar Fix

Safe Modular Circular Initialisation with Placeholders and Placeholder Types

  • Conference paper
ECOOP 2013 – Object-Oriented Programming (ECOOP 2013)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 7920))

Included in the following conference series:

Abstract

Programmers often need to initialise circular structures of objects. Initialisation should be safe (so that programs can never suffer null pointer exceptions or otherwise observe uninitialised values) and modular (so that each part of the circular structure can be written and compiled separately). Unfortunately, existing languages do not support modular circular initialisation: programmers in practical languages resort to Tony Hoare’s “Billion Dollar Mistake”: initialising variables with nulls, and then hoping to fix them up afterward. While recent research languages have offered some solutions, none fully support safe modular circular initialisation.

We present placeholders, a straightforward extension to object-oriented languages that describes circular structures simply, directly, and modularly. In typed languages, placeholders can be described by placeholder types that ensure placeholders are used safely. We define an operational semantics for placeholders, a type system for placeholder types, and prove soundness. Incorporating placeholders into object-oriented languages should make programs simultaneously simpler to write, and easier to write correctly.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Birka, A., Ernst, M.D.: A practical type system and language for reference immutability. In: OOPSLA, pp. 35–49 (2004)

    Google Scholar 

  2. Bracha, G.: Executable grammars in Newspeak. In: JAOO (2007)

    Google Scholar 

  3. Bracha, G., von der Ahé, P., Bykov, V., Kashai, Y., Maddox, W., Miranda, E.: Modules as objects in Newspeak. In: D’Hondt, T. (ed.) ECOOP 2010. LNCS, vol. 6183, pp. 405–428. Springer, Heidelberg (2010), http://dl.acm.org/citation.cfm?id=1883978.1884007

    Chapter  Google Scholar 

  4. Counsell, S., Loizou, G., Najjar, R.: Evaluation of the ‘replace constructors with creation methods’ refactoring in Java systems. IET Software 4(5), 318–333 (2010)

    Article  Google Scholar 

  5. Fähndrich, M., Xia, S.: Establishing object invariants with delayed types. In: OOPSLA. pp. 337–350 (2007)

    Google Scholar 

  6. Fowler, M.: Refactoring: Improving the Design of Existing Code. Addison-Wesley (2000)

    Google Scholar 

  7. Gamma, E., Helm, R., Johnson, R.E., Vlissides, J.M.: Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley Professional Computing Series. Addison-Wesley (1995)

    Google Scholar 

  8. Gil, J(Y.), Shragai, T.: Are we ready for a safer construction environment? In: Drossopoulou, S. (ed.) ECOOP 2009. LNCS, vol. 5653, pp. 495–519. Springer, Heidelberg (2009)

    Chapter  Google Scholar 

  9. Gordon, C.S., Parkinson, M.J., Parsons, J., Bromfield, A., Duffy, J.: Uniqueness and reference immutability for safe parallelism. In: OOPSLA, pp. 21–40 (2012)

    Google Scholar 

  10. Haack, C., Poll, E.: Type-based object immutability with flexible initialization. In: Drossopoulou, S. (ed.) ECOOP 2009. LNCS, vol. 5653, pp. 520–545. Springer, Heidelberg (2009)

    Chapter  Google Scholar 

  11. Hoare, C.A.R.: The emperor’s old clothes. Comm. ACM 24(2) (February 1981)

    Google Scholar 

  12. Hoare, C.: Null references: The billion dollar mistake (March 2009), abstract of QCon London Keynote qconlondon.com/london-2009/presentation/Null+References:+The+Billion+Dollar+Mistake

  13. Igarashi, A., Pierce, B.C., Wadler, P.: Featherweight Java: A minimal core calculus for Java and GJ. In: OOPSLA, pp. 132–146 (1999)

    Google Scholar 

  14. Leroy, X.: The Objective Caml system (release 2.00) (August 1998), http://paulliac.inria.fr/caml

  15. Oliveira, B.C.d.S., Cook, W.R.: Extensibility for the masses - practical extensibility with object algebras. In: Noble, J. (ed.) ECOOP 2012. LNCS, vol. 7313, pp. 2–27. Springer, Heidelberg (2012)

    Chapter  Google Scholar 

  16. Qi, X., Myers, A.C.: Masked types for sound object initialization. In: POPL, pp. 53–65 (2009)

    Google Scholar 

  17. Servetto, M., Mackay, J., Potanin, A., Noble, J.: The billion dollar fix: Safe modular circular initialisation with placeholders and placeholder types. Tech. Rep. 12-25, ECS, VUW (2012), http://ecs.victoria.ac.nz/Main/TechnicalReportSeries

  18. Servetto, M., Potanin, A.: Our billion dollar fix. Tech. Rep. 12-19, ECS, VUW (2012), http://ecs.victoria.ac.nz/Main/TechnicalReportSeries

  19. Summers, A.J., Müller, P.: Freedom before commitment - a lightweight type system for object initialisation. In: OOPSLA, pp. 1013–1032 (2011)

    Google Scholar 

  20. Syme, D.: Initializing mutually referential abstract objects: The value recursion challenge. Electronic Notes in Theoretical Computer Science 148(2), 3–25 (2006)

    Article  Google Scholar 

  21. Zibin, Y., Cunningham, D., Peshansky, I., Saraswat, V.: Object initialization in X10. In: Noble, J. (ed.) ECOOP 2012. LNCS, vol. 7313, pp. 207–231. Springer, Heidelberg (2012)

    Chapter  Google Scholar 

  22. Zibin, Y., Potanin, A., Artzi, S., Kiezun, A., Ernst, M.D.: Object and reference immutability using Java generics. In: Foundations of Software Engineering (2007)

    Google Scholar 

  23. Zibin, Y., Potanin, A., Li, P., Ali, M., Ernst, M.D.: Ownership and immutability in generic Java. In: OOPSLA, pp. 598–617 (2010)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2013 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Servetto, M., Mackay, J., Potanin, A., Noble, J. (2013). The Billion-Dollar Fix. In: Castagna, G. (eds) ECOOP 2013 – Object-Oriented Programming. ECOOP 2013. Lecture Notes in Computer Science, vol 7920. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-39038-8_9

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-39038-8_9

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-39037-1

  • Online ISBN: 978-3-642-39038-8

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics