3. Safe Languages

A key property of a program s that one part should only depend on another if it names it. This seems obvious, but in fact it ’s a property that only holds for programs written in so-called safe languages.

In an unsafe language, the text in one part can affect the behaviour of another without any names being shared. This leads to insidious bugs that are very hard to track down,and which can have disastrous and unpredictable effects.

Here’s how it happens:

Consider a program written in C in where an array is updated beyond its bounds. The result may be to overwrite an arbitrary piece of memory. It can affect the value of a data structure with a name that is declared in a different module.

Safe languages rule this out by combining several techniques, like:

Safe languages have been around since 1960: Algol-60, Pascal, Modula, LISP, Ada, and now Java.

Java benefited from a lot of early hype about applets,and now that it’s widely used, many companies have taken the plunge and are recognizing the benefits of using a safe language.