Void safety: Getting rid of the spectre of null-pointer dereferencing
A spectre is haunting programming — the spectre of null-pointer dereferencing. All the programming languages of old Europe and the New World have entered into a holy alliance to make everyone’s programs brittle: Java, C, Pascal, C++, C# and yes, until recently, Eiffel.
The culprit is the use of references to denote objects used in calls: in
x.f (...)
the value of x is a reference, which normally denotes an object but could at any time be void (or “null”). If this happens, the resulting “void call” will cause an exception and, usually, a crash. No amount of testing can remove the risk entirely; the only satisfactory solution is a static one, enforcing void safety at the language level.
To this end, Eiffelists of various nationalities have assembled in the Cloud and sketched the following manifesto, to be published in the English language:
Avoid a Void: The Eradication of Null Dereferencing Bertrand Meyer, Alexander Kogtenkov, Emmanuel Stapf White paper available here.