Void safety
Encyclopedia
Void safety is a guarantee within an object-oriented programming language that that no object references
will have null or void values.
In object-oriented languages, access to objects is achieved through references
(or, equivalently, pointers). A typical call is of the form:
x.f(a, ...)
where f denotes an operation and x denotes a reference to some object. At execution time, however, a reference can be void (or null). In such cases, the call above will be a void call, leading to a run-time exception
, often resulting in abnormal termination
of the program.
Void safety is a static (compile-time) guarantee that no void calls will ever arise.
language (although the Lisp language had the NIL value as early as 1959) and called it a "mistake":
Bertrand Meyer introduced the term "void safety".
The Spec# language
, a research language from Microsoft Research, has a notion of "non-nullable type" addressing void safety.
The Eiffel language
is void-safe according to its ISO-ECMA
standard; the void-safety mechanism is implemented in EiffelStudio
starting with version 6.1 and continuing to mature through version 6.4.
Reference (computer science)
In computer science, a reference is a value that enables a program to indirectly access a particular data item, such as a variable or a record, in the computer's memory or in some other storage device. The reference is said to refer to the data item, and accessing those data is called...
will have null or void values.
In object-oriented languages, access to objects is achieved through references
Reference (computer science)
In computer science, a reference is a value that enables a program to indirectly access a particular data item, such as a variable or a record, in the computer's memory or in some other storage device. The reference is said to refer to the data item, and accessing those data is called...
(or, equivalently, pointers). A typical call is of the form:
x.f(a, ...)
where f denotes an operation and x denotes a reference to some object. At execution time, however, a reference can be void (or null). In such cases, the call above will be a void call, leading to a run-time exception
Exception handling
Exception handling is a programming language construct or computer hardware mechanism designed to handle the occurrence of exceptions, special conditions that change the normal flow of program execution....
, often resulting in abnormal termination
Crash (computing)
A crash in computing is a condition where a computer or a program, either an application or part of the operating system, ceases to function properly, often exiting after encountering errors. Often the offending program may appear to freeze or hang until a crash reporting service documents...
of the program.
Void safety is a static (compile-time) guarantee that no void calls will ever arise.
History
In a 2009 talk, Tony Hoare traced the invention of the null pointer to his design of the Algol WALGOL W
ALGOL W is a programming language. It was based on a proposal for ALGOL X by Niklaus Wirth and C. A. R. Hoare as a successor to ALGOL 60 in IFIP Working Group 2.1. When the committee decided that the proposal was not a sufficient advance over ALGOL 60, the proposal was published as A contribution...
language (although the Lisp language had the NIL value as early as 1959) and called it a "mistake":
Bertrand Meyer introduced the term "void safety".
In programming languages
An early attempt to guarantee void safety was the design of the Self programming language.The Spec# language
Spec sharp
Spec# is a programming language with specification language features that extends the capabilities of the C# programming language with Eiffel-like contracts, including object invariants, preconditions and postconditions. Like ESC/Java, it includes a static checking tool based on a theorem prover...
, a research language from Microsoft Research, has a notion of "non-nullable type" addressing void safety.
The Eiffel language
Eiffel (programming language)
Eiffel is an ISO-standardized, object-oriented programming language designed by Bertrand Meyer and Eiffel Software. The design of the language is closely connected with the Eiffel programming method...
is void-safe according to its ISO-ECMA
Ecma International
Ecma International is an international, private non-profit standards organization for information and communication systems. It acquired its name in 1994, when the European Computer Manufacturers Association changed its name to reflect the organization's global reach and activities...
standard; the void-safety mechanism is implemented in EiffelStudio
EiffelStudio
EiffelStudio is a development environment for the Eiffel programming language developed and distributed by Eiffel Software.EiffelStudio includes a combination of tools integrated under a single user interface: compiler, interpreter, debugger, browser, metrics tool, profiler, diagram tool...
starting with version 6.1 and continuing to mature through version 6.4.