Strict programming language explained

A strict programming language is a programming language that only allows strict functions (functions whose parameters must be evaluated completely before they may be called) to be defined by the user. A non-strict programming language allows the user to define non-strict functions, and hence may allow lazy evaluation. In most non-strict languages, the non-strictness extends to data constructors.

Description

A strict programming language is a programming language which employs a strict programming paradigm, allowing only strict functions (functions whose parameters must be evaluated completely before they may be called) to be defined by the user. A non-strict programming language allows the user to define non-strict functions, and hence may allow lazy evaluation.

Non-strictness has several disadvantages which have prevented widespread adoption:

Strict programming languages are often associated with eager evaluation, and non-strict languages with lazy evaluation, but other evaluation strategies are possible in each case. The terms "eager programming language" and "lazy programming language" are often used as synonyms for "strict programming language" and "non-strict programming language" respectively.

Examples

Nearly all programming languages in common use today are strict. Examples include C#, Java, Perl (all versions, i.e. through version 5 and version 7), Python,[1] Ruby, Common Lisp, and ML. Some strict programming languages include features that mimic laziness. Raku (formerly known as Perl 6) has lazy lists,[2] Python has generator functions,[3] and Julia provides a macro system to build non-strict functions, as does Scheme.

Examples for non-strict languages are Haskell, R, Miranda, and Clean.

Extension

In most non-strict languages, the non-strictness extends to data constructors. This allows conceptually infinite data structures (such as the list of all prime numbers) to be manipulated in the same way as ordinary finite data structures. It also allows for the use of very large but finite data structures such as the complete game tree of chess.

Notes and References

  1. Book: Lott . Steven . Functional Python Programming. . 2015 . Packt Publishing . Birmingham, UK . 978-1-78439-699-2 . 35 . Python focuses on strict evaluation.
  2. Web site: Raku Programming/Lazy Lists and Feeds - Wikibooks, open books for an open world. 2021-02-09. en.wikibooks.org.
  3. Book: Lott . Steven . Functional Python Programming. . 2015 . Packt Publishing . Birmingham, UK . 978-1-78439-699-2 . 35 . a generator function is non-strict. [...] we can leverage generator functions to create lazy evaluation..