Content deleted Content added
→Examples: lambda calculus, and streams with beta reduction and partial ... in java 8 |
No edit summary |
||
Line 2:
A '''strict programming language''' is one in which only [[strict function]]s (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]].{{Sfn|Scott|2006|p=541}}
==
Nearly all [[programming language]]s in common use today are strict. Examples include [[C Sharp (programming language)|C#]], [[Java (programming language)|Java]] (prior to Java 8), [[Perl]] (through version 5), [[Python (programming language)|Python]], [[Ruby (programming language)|Ruby]], [[Common Lisp]], and [[ML (programming language)|ML]]. Examples for non-strict languages are [[Haskell (programming language)|Haskell]], [[Miranda (programming language)|Miranda]], and [[Clean (programming language)|Clean]].{{Sfn|Cluet & Hull|1998|pp=
Languages whose ordinary functions are strict but which provide a [[Macro (computer science)|macro system]] to build non-strict functions include [[C (programming language)|C]], [[C++]], and [[Scheme (programming language)|Scheme]].
==
In most non-strict languages the non-strictness extends to [[algebraic data type|data constructor]]s. This allows conceptually infinite data structures (such as the list of all [[prime number]]s) 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 [[computer architecture|hardware architecture]]s 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.
Line 19 ⟶ 17:
In many strict languages, some advantages of non-strict functions can be obtained through the use of [[Macro (computer science)|macros]] or [[thunk]]s.
==Citations==
Line 74 ⟶ 71:
}}
{{Refend}}
[[Category:Programming paradigms]]
|