Strict programming language
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)
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.
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; Raku, formerly known as Perl 6, has lazy lists), Python, Ruby, Common Lisp, and ML. Examples for non-strict languages are Haskell, Miranda, and Clean. Languages whose ordinary functions are strict but which provide a macro system to build non-strict functions include Julia, and Scheme. Lazy lists can also be made in C, and C++.
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:
- Because of the uncertainty regarding if and when expressions will be evaluated, non-strict languages generally must be purely functional to be useful.
- All hardware architectures in common use are optimized for strict languages, so the best compilers for non-strict languages produce slower code than the best compilers for strict languages.
- Space complexity of non-strict programs is difficult to understand and predict.
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.
- Scott 2006, p. 541.
- "Raku Programming/Lazy Lists and Feeds - Wikibooks, open books for an open world". en.wikibooks.org. Retrieved 2021-02-09.
- Cluet & Hull 1998, pp. 25–26.
- Innes, Mike J. (2021-02-06), MikeInnes/Lazy.jl, retrieved 2021-02-09
- "Lazy List in C". Standards. 2011-11-15. Retrieved 2021-02-09.
- Scott, Michael Lee (2006) , McFadden, Nate; et al. (eds.), Programming Language Pragmatics, Volume 2, Published by Denise Penrose (2nd ed.), San Francisco: Morgan Kaufmann, ISBN 9780126339512, OCLC 551774322, retrieved 21 November 2014
|volume=has extra text (help)
- Cluet, Sophie; Hull, Rick; et al., eds. (1998) , Database Programming Languages, Lecture Notes in Computer Science, Volume 1369, Berlin; Heidelberg: Springer, ISBN 9783540648239, ISSN 0302-9743, OCLC 873553545, retrieved 21 November 2014
|volume=has extra text (help)