Strict programming language: Difference between revisions

Content deleted Content added
A ''non-strict programming language'' is one which is not strict, and hence may allow lazy evaluation.
oops, I think Mercury is strict. Also added a note on "lazy/eager p.l."
Line 1:
A '''strict programming language''' is one in which only [[strict function]]s may be defined by the user. A ''non-strict programming language'' is one which is not strict, and hence may allow [[lazy evaluation]].
 
Nearly all [[programming language]]s in common use today are strict. Examples include [[C programming language|C]], [[C Plus Plus|C++]], [[Java programming language|Java]], [[Perl programming language|Perl]], [[Python programming language|Python]], [[Ruby programming language|Ruby]], [[Common Lisp programming language|Common Lisp]], [[Scheme programming language|Scheme]], and [[ML programming language|ML]]. The best known non-strict languages are [[Haskell programming language|Haskell]], [[Miranda programming language|Miranda]], [[Mercury programming language|Mercury]], and [[Clean programming language|Clean]].
 
In most non-strict languages the non-strictness extends to [[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]].
Line 11:
* The [[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.
 
In many strict languages, some of the advantages of non-strict functions can be obtained through the use of [[macro]]s.