Strict programming language

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

Examples

Nearly all programming languages in common use today are strict. Examples include C#, Java (prior to Java 8), Perl (through version 5), Python, Ruby, Common Lisp, and ML. Examples for non-strict languages are Haskell, Miranda, and Clean.[2] Languages whose ordinary functions are strict but which provide a macro system to build non-strict functions include C, C++, and Scheme.

Explanation

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.

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.

In many strict languages, some advantages of non-strict functions can be obtained through the use of macros or thunks.

Citations

  1. Scott 2006, p. 541.
  2. Cluet & Hull 1998, pp. 25–26.

References

This article is issued from Wikipedia - version of the 10/26/2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.