2.2  Place on the Purity Spectrum.

The functional programming community is centrally concerned with side effects, and in particular avoiding side effects, because expressions without side effects obey the fundamental rule that “equals may be substituted for equals” upon which much algebraic reasoning is based. Languages or portions of a program which obey this rule should be that much easier to understand, reason about and modify. Code which uses no side effects is termed pure; other code is termed impure.

The impure end of the programming language spectrum is anchored by older languages like Pascal, C and Lisp which side-effects in almost every statement. In general every field of every C record is writable and likely to actually get written from time to time. Such languages are often termed imperative; minimizing use of side-effects was not a goal in their design. (In part because they were designed in an era of small machines and small programs; taming the complexity of million-line programs was not an issue back then.)

The pure end of the programming language spectrum is anchored by pure-functional languages such as Haskell which completely forbid the use of side-effects, or at any rate side-effects as we know them. This complete freedom from side-effects yields some benefits such as the ability to write fully lazy code. However, having to completely avoid use of algorithms which depend upon side-effects is a major constraint upon the programmer; for many problems the best known algorithms require the use of side effects. Simon Peyton-Jones refers to programming under this strict constraint as "wearing the hair shirt".

Mythryl sits at neither end of the purity spectrum, but instead within it, closest to the pure end. Mythryl does allow the use of side effects, but typical Mythryl programs use only about one percent as many side-effects as a typical C program. This means that, assuming equal programmer skill, Mythryl programs should experience only about one percent as many side-effect related bugs (such as race conditions) as an equivalent C++ or Java program.

Comments and suggestions to: