Jump to content

Void safety

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by J Casanova (talk | contribs) at 23:44, 2 August 2009 (Fixed reference to Spec# language (pointed to wrong page)). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In object-oriented languages, access to objects is often achieved through references (or, equivalently, pointers). The typical call is of the form

x.f (a, ...)

where f denotes an operation and x a reference to an object. At execution time, however, a reference can be "void", or "null"; then the above call will be a "void call", leading to a run-time Exception handling, often resulting in a crash.

Void safety is a static (compile-time) guarantee that no void calls will ever arise.


In a 2009 talk [1], Tony Hoare traced the invention null pointer to his design of the Algol W language and called it his "billion-dollar mistake". As early as 1959, however, the Lisp language had the NIL value.

An early attempt to guarantee void safety was the design of the Self programming language.

The Spec# programming language has a notion of "non-nullable type" addressing void safety.

Reference [2] introduced the term "void safety".

References

  1. ^ C.A.R. Hoare: Null References: The Billion Dollar Mistake, abstract of a talk at QCon London, 9-12 March 2009, available online
  2. ^ Bertrand Meyer: Attached Types and their Application to Three Open Problems of Object-Oriented Programming, in ECOOP 2005 (Proceedings of European Conference on Object-Oriented Programming, Edinburgh, 25-29 July 2005), ed. Andrew Black, Lecture Notes in Computer Science 3586, Springer Verlag, 2005, pages 1-32, also available online