Strict programming language
A strict programming language is a programming language that only allows strict functions 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 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.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.
- In many strict languages, some advantages of non-strict functions can be obtained through the use of macros or thunks.
Examples
Nearly all programming languages in common use today are strict. Examples include C#, Java, Perl, Python, Ruby, Common Lisp, and ML. Some strict programming languages include features that mimic laziness. Raku has lazy lists, Python has generating functions, and Julia provides a macro system to build non-strict functions, as does Scheme.Examples for non-strict languages are Haskell, R, Miranda, and Clean.