Greenspun's Tenth Rule

From Wikipedia, the free encyclopedia

Jump to: navigation, search

Greenspun's Tenth Rule of Programming is a common aphorism in computer programming and especially programming language circles. It states:[1]

Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp.[2]

Contents

[edit] Origin

The rule was written sometime around 1993 by Philip Greenspun. Although it is known as his tenth rule, there are in fact no preceding rules, only the tenth. The reason for this according to Greenspun: "Sorry, Han-Wen, but there aren't 9 preceding laws. I was just trying to give the rule a memorable name."[3]

[edit] Meaning

The interpretation is that programmers, constrained by low-level, primitive tools like C, often work around the limitations of their languages by inventing and implementing features found in more expressive languages such as Lisp.

[edit] Morris's Corollary

Well-known hacker Robert Morris later added the corollary:

…including Common Lisp[4].

This can be viewed as a commentary on the difficulty of creating an efficient implementation of the large and complex Common Lisp language, or simply a joke about Lisp's eval function. Both Greenspun's rule and Morris's corollary are examples of a characteristic style of hacker humor known as "ha ha only serious".[5]

(Nonetheless, most Common Lisp systems are not written in C or Fortran. Exceptions exist, such as GNU CLISP; however, systems such as Steel Bank Common Lisp are written chiefly in Lisp itself, just as C compilers are usually written in C.)

[edit] Prolog follow-up

Any sufficiently complicated LISP program is going to contain a slow implementation of half of Prolog. [6]

Addresses the fact that pure Prolog programs are likely to include Lisp-like isles, and pure Lisp programs are likely to do the converse.

[edit] Erlang follow-up

With the advent of distributed computing and popularization of concepts implemented in Erlang, Robert Virding postulated that:

Any sufficiently complicated concurrent program in another language contains an ad hoc informally-specified bug-ridden slow implementation of half of Erlang. [7]

This has been later referred to as Armstrong's corollary

[edit] Generalization

The rule is often modified by replacing "Common Lisp" with the speaker's functional language of choice, such as Scheme or Haskell. Making it a snowclone of the form:

Any sufficiently complicated platform contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of a functional programming language.[citation needed]

[edit] See also

[edit] References

Personal tools
Languages