Greenspun's tenth rule

Last updated

Greenspun's tenth rule of programming is an aphorism in computer programming and especially programming language circles that states: [1] [2]

Contents

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

Overview

The rule expresses the opinion that the argued flexibility and extensibility designed into the programming language Lisp includes all functionality that is theoretically needed to write any complex computer program, and that the features required to develop and manage such complexity in other programming languages are equivalent to some subset of the methods used in Lisp.

Other programming languages, while claiming to be simpler, require programmers to reinvent in a haphazard way a significant amount of needed functionality that is present in Lisp as a standard, time-proven base.

It can also be interpreted as a satiric critique of systems that include complex, highly configurable sub-systems. [3] Rather than including a custom interpreter for some domain-specific language, Greenspun's rule suggests using a widely accepted, fully featured language like Lisp.

Paul Graham also highlights the satiric nature of the concept, albeit based on real issues:

That sounds like a joke, but it happens so often to varying degrees in large programming projects that there is a name for the phenomenon, Greenspun’s Tenth Rule. [4]

The rule was written sometime around 1993 by Philip Greenspun. Although it is known as his tenth rule, this is a misnomer. 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. [5]

Hacker Robert Morris later declared a corollary, which clarifies the set of "sufficiently complicated" programs to which the rule applies:

…including Common Lisp. [6]

This corollary jokingly refers to the fact that many Common Lisp implementations (especially those available in the early 1990s) depend upon a low-level core of compiled C, which sidesteps the issue of bootstrapping but may itself be somewhat variable in quality, at least compared to a cleanly self-hosting Common Lisp. [7]

See also

Related Research Articles

<span class="mw-page-title-main">Computer program</span> Instructions to be executed by a computer

A computer program is a sequence or set of instructions in a programming language for a computer to execute. It is one component of software, which also includes documentation and other intangible components.

<span class="mw-page-title-main">Common Lisp</span> Programming language standard

Common Lisp (CL) is a dialect of the Lisp programming language, published in American National Standards Institute (ANSI) standard document ANSI INCITS 226-1994 (S2018). The Common Lisp HyperSpec, a hyperlinked HTML version, has been derived from the ANSI Common Lisp standard.

<span class="mw-page-title-main">Lisp (programming language)</span> Programming language family

Lisp is a family of programming languages with a long history and a distinctive, fully parenthesized prefix notation. Originally specified in the late 1950s, it is the second-oldest high-level programming language still in common use, after Fortran. Lisp has changed since its early days, and many dialects have existed over its history. Today, the best-known general-purpose Lisp dialects are Common Lisp, Scheme, Racket, and Clojure.

<span class="mw-page-title-main">Scheme (programming language)</span> Dialect of Lisp

Scheme is a dialect of the Lisp family of programming languages. Scheme was created during the 1970s at the MIT Computer Science and Artificial Intelligence Laboratory and released by its developers, Guy L. Steele and Gerald Jay Sussman, via a series of memos now known as the Lambda Papers. It was the first dialect of Lisp to choose lexical scope and the first to require implementations to perform tail-call optimization, giving stronger support for functional programming and associated techniques such as recursive algorithms. It was also one of the first programming languages to support first-class continuations. It had a significant influence on the effort that led to the development of Common Lisp.

<span class="mw-page-title-main">Interpreter (computing)</span> Program that executes source code without a separate compilation step

In computer science, an interpreter is a computer program that directly executes instructions written in a programming or scripting language, without requiring them previously to have been compiled into a machine language program. An interpreter generally uses one of the following strategies for program execution:

  1. Parse the source code and perform its behavior directly;
  2. Translate source code into some efficient intermediate representation or object code and immediately execute that;
  3. Explicitly execute stored precompiled bytecode made by a compiler and matched with the interpreter's Virtual Machine.

In software engineering and computer science, abstraction is the process of generalizing concrete details, such as attributes, away from the study of objects and systems to focus attention on details of greater importance. Abstraction is a fundamental concept in computer science and software engineering, especially within the object-oriented programming paradigm. Examples of this include:

In computer science, a preprocessor is a program that processes its input data to produce output that is used as input in another program. The output is said to be a preprocessed form of the input data, which is often used by some subsequent programs like compilers. The amount and kind of processing done depends on the nature of the preprocessor; some preprocessors are only capable of performing relatively simple textual substitutions and macro expansions, while others have the power of full-fledged programming languages.

Bytecode is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references that encode the result of compiler parsing and performing semantic analysis of things like type, scope, and nesting depths of program objects.

In computer science, a metaobject is an object that manipulates, creates, describes, or implements objects. The object that the metaobject pertains to is called the base object. Some information that a metaobject might define includes the base object's type, interface, class, methods, attributes, parse tree, etc. Metaobjects are examples of the computer science concept of reflection, where a system has access to its own internal structure. Reflection enables a system to essentially rewrite itself on the fly, to alter its own implementation as it executes.

A read–eval–print loop (REPL), also termed an interactive toplevel or language shell, is a simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user; a program written in a REPL environment is executed piecewise. The term usually refers to programming interfaces similar to the classic Lisp machine interactive environment. Common examples include command-line shells and similar environments for programming languages, and the technique is very characteristic of scripting languages.

ICAD is a knowledge-based engineering (KBE) system that enables users to encode design knowledge using a semantic representation that can be evaluated for Parasolid output. ICAD has an open architecture that can utilize all the power and flexibility of the underlying language.

<span class="mw-page-title-main">StumpWM</span>

StumpWM is a tiling window manager that was created when developer Shawn Betts found ratpoison growing increasingly large and "lispy". Intended as a successor to ratpoison, StumpWM is released under the terms of the GPL-2.0-or-later license.

LispWorks is computer software, a proprietary implementation and integrated development environment (IDE) for the programming language Common Lisp. LispWorks was developed by the UK software company Harlequin Ltd., and first published in 1989. Harlequin ultimately spun off its Lisp division as Xanalys Ltd., which took over management and rights to LispWorks. In January 2005, the Xanalys Lisp team formed LispWorks Ltd. to market, develop, and support the software.

New Implementation of LISP (NIL) is a programming language, a dialect of the language Lisp, developed at the Massachusetts Institute of Technology (MIT) during the 1970s, and intended to be the successor to the language Maclisp. It is a 32-bit implementation, and was in part a response to Digital Equipment Corporation's (DEC) VAX computer. The project was headed by Jon L White, with a stated goal of maintaining compatibility with MacLisp while fixing many of its problems.

<span class="mw-page-title-main">Clojure</span> Dialect of the Lisp programming language on the Java platform

Clojure is a dynamic and functional dialect of the Lisp programming language on the Java platform.

In computer programming, a parser combinator is a higher-order function that accepts several parsers as input and returns a new parser as its output. In this context, a parser is a function accepting strings as input and returning some structure as output, typically a parse tree or a set of indices representing locations in the string where parsing stopped successfully. Parser combinators enable a recursive descent parsing strategy that facilitates modular piecewise construction and testing. This parsing technique is called combinatory parsing.

Emacs, originally named EMACS, is a family of text editors that are characterized by their extensibility. The manual for the most widely used variant, GNU Emacs, describes it as "the extensible, customizable, self-documenting, real-time display editor". Development of the first Emacs began in the mid-1970s, and work on GNU Emacs, directly descended from the original, is ongoing; its latest version is 29.2, released January 2024.

<span class="mw-page-title-main">Alice K. Hartley</span> American computer scientist (1937–2017)

Alice Hartley (1937–2017) was an American computer scientist and business woman. Hartley worked on several dialects of Lisp, implementing multiple parts of Interlisp, maintaining Macintosh Common Lisp, and developing concepts in computer science and programming language design still in use today.

References

  1. Greenspun, Philip (1990–2017). "Philip Greenspun's Research" . Retrieved 2020-12-23.
  2. Graham, Paul (May 2002). "Revenge of the Nerds" . Retrieved 2023-05-01.
  3. "Greenspun's Tenth Rule, does every large project include a Lisp interpreter?". Stack Exchange. 2017-04-12. Retrieved 2023-05-01.
  4. Graham, Paul (2004). Hackers & Painters: Big Ideas from the Computer Age. O'Reilly Media. ISBN   978-0-596-00662-4.
  5. Greenspun, Philip (September 27, 2003). "10th rule of programming".
  6. "Lisp Quotes". paulgraham.com.
  7. Rhodes, Christophe (2008-05-15). SBCL: a Sanely-Bootstrappable Common Lisp (PDF). Lecture Notes in Computer Science. Retrieved 2023-05-01.