"Avoid a Void" paper
bearophile
bearophileHUGS at lycos.com
Tue Mar 30 13:49:47 PDT 2010
I've just found and read a paper, probably about one year old,
"Avoid a Void: The eradication of null dereferencing",
by Bertrand Meyer, Alexander Kogtenkov and Emmanuel Stapf:
http://se.ethz.ch/~meyer/publications/hoare/void-safety.pdf
The paper is about the introduction of void safety in a language that so far has had void references on default. Having D2 missed the boat of a void-safety design from the start, if it will want to become void-safe it will need to transition as Eiffel will do. Such transition is a little painful, but in theory it seems doable.
>From the article:
>This observation suggests a software design guideline: confine void references to specific parts of a system, largely preserving the application-oriented layers from having to worry about the issues discussed in this article. It also confirms our expectation that the conversion of typical user applications will require significantly less effort than our initial experiences, which involved system-level libraries.<
So the allow void references/pointers in "system" modules, for example to represent the end of a linked list. While "safe" modules that contain most of the application code can be void-safe. This is a good compromise (but a high performance video game written in D risks having a higher percentage of "system" modules).
Bye,
bearophile
More information about the Digitalmars-d
mailing list