Void safety: Difference between revisions
J Casanova (talk | contribs) Added references as requested, removed the corresponding request (but not the request for expansionO |
J Casanova (talk | contribs) Added mention of pointers, and references to the corresponding page |
||
Line 1: | Line 1: | ||
{{unreferenced|date=August 2009}} |
{{unreferenced|date=August 2009}} |
||
In [[object-oriented language|object-oriented languages]], access to objects is often achieved through [[Reference (computer science)|references]]. The typical call is of the form |
In [[object-oriented language|object-oriented languages]], access to objects is often achieved through [[Reference (computer science)|references]] (or, equivalently, [[pointer (computing)|pointers]]). The typical call is of the form |
||
x.f (a, ...) |
: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. |
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. |
Revision as of 23:38, 2 August 2009
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.
Reference [1] introduced the term "void safety".
In a 2009 talk [2], 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.
References
- ^ 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
- ^ C.A.R. Hoare: Null References: The Billion Dollar Mistake, abstract of a talk at QCon London, 9-12 March 2009, available online