Strict programming language: Difference between revisions
imported>Dan Leonard Undid revision 1261542589 by Leongoogology (talk): not how to format links |
|||
| Line 18: | Line 18: | ||
==Examples== | ==Examples== | ||
Nearly all [[programming language]]s in common use today are strict.{{Citation needed|date=April 2024}} Examples include [[C Sharp (programming language)|C#]], [[Java (programming language)|Java]], [[Perl]] (all versions, i.e. through | Nearly all [[programming language]]s in common use today are strict.{{Citation needed|date=April 2024}} Examples include [[C Sharp (programming language)|C#]], [[Java (programming language)|Java]], [[Perl]] (all versions, i.e., through versions 5 and 7), [[Python (programming language)|Python]],<ref>{{cite book |last1=Lott |first1=Steven |title=Functional Python Programming |date=2015 |publisher=Packt Publishing |location=Birmingham, UK |isbn=978-1-78439-699-2 |page=35 |quote=Python focuses on strict evaluation}}</ref> [[Ruby (programming language)|Ruby]], [[Common Lisp]], and [[ML (programming language)|ML]]. Some strict programming languages include features that mimic laziness.{{Clarify|date=April 2024|reason=Explain what it means to "mimic laziness"}} [[Raku (programming language)|Raku]] (formerly named Perl 6) has lazy lists,<ref>{{Cite web|title=Raku Programming/Lazy Lists and Feeds - Wikibooks, open books for an open world|url=https://en.wikibooks.org/wiki/Raku_Programming/Lazy_Lists_and_Feeds|access-date=2021-02-09|website=en.wikibooks.org}}</ref> [[Python (programming language)|Python]] has [[generating function]]s,<ref>{{cite book |last1=Lott |first1=Steven |title=Functional Python Programming |date=2015 |publisher=Packt Publishing |location=Birmingham, UK |isbn=978-1-78439-699-2 |page=35 |quote=a generator function is non-strict. [...] we can leverage generator functions to create lazy evaluation.}}</ref> and [[Julia (programming language)|Julia]] provides a [[Macro (computer science)#Hygienic macros|macro system]] to build non-strict functions,<ref>{{Citation|last=Innes|first=Mike J.|title=MikeInnes/Lazy.jl|date=2021-02-06|url=https://github.com/MikeInnes/Lazy.jl|access-date=2021-02-09}}</ref> as does [[Scheme (programming language)|Scheme]]. | ||
Examples for non-strict languages are [[ | Examples for non-strict languages are [[Haskell]], [[R (programming language)|R]], [[Miranda (programming language)|Miranda]], and [[Clean (programming language)|Clean]].{{Sfn|Cluet & Hull|1998|pp=25–26}} | ||
==Extension== | ==Extension== | ||
| Line 41: | Line 41: | ||
| others =Published by Denise Penrose | | others =Published by Denise Penrose | ||
| date =2006 | | date =2006 | ||
| | | orig-date =1999 | ||
| title =Programming Language Pragmatics | | title =Programming Language Pragmatics | ||
| edition ={{Ordinal|2|sup=yes}} | | edition ={{Ordinal|2|sup=yes}} | ||
| Line 65: | Line 65: | ||
| display-editors =2 | | display-editors =2 | ||
| date =1998 | | date =1998 | ||
| | | orig-date =1997 | ||
| title =Database Programming Languages | | title =Database Programming Languages | ||
| series =Lecture Notes in Computer Science | | series =Lecture Notes in Computer Science | ||
| Line 79: | Line 79: | ||
}} | }} | ||
{{Refend}} | {{Refend}} | ||
{{Programming paradigms navbox}} | |||
[[Category:Programming paradigms]] | [[Category:Programming paradigms]] | ||
[[Category:Evaluation strategy]] | [[Category:Evaluation strategy]] | ||
Latest revision as of 02:13, 1 January 2026
Template:Short description Script error: No such module "Unsubst".
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.Template:Sfn
Non-strictness has several disadvantages which have prevented widespread adoption:Script error: No such module "Unsubst".
- 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.
- In many strict languages, some advantages of non-strict functions can be obtained through the use of macros or thunks.
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.Script error: No such module "Unsubst". The terms "eager programming language" and "lazy programming language" are often used as synonyms for "strict programming language" and "non-strict programming language" respectively.Script error: No such module "Unsubst".
Examples
Nearly all programming languages in common use today are strict.Script error: No such module "Unsubst". Examples include C#, Java, Perl (all versions, i.e., through versions 5 and 7), Python,[1] Ruby, Common Lisp, and ML. Some strict programming languages include features that mimic laziness.Script error: No such module "Unsubst". Raku (formerly named Perl 6) has lazy lists,[2] Python has generating functions,[3] and Julia provides a macro system to build non-strict functions,[4] as does Scheme.
Examples for non-strict languages are Haskell, R, Miranda, and Clean.Template:Sfn
Extension
Script error: No such module "Unsubst". 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.
Citations
<templatestyles src="Reflist/styles.css" />
Script error: No such module "Check for unknown parameters".
References
<templatestyles src="Refbegin/styles.css" />
- Script error: No such module "citation/CS1".
- Script error: No such module "citation/CS1".