Difference between revisions of "Non-strict programming language"
Karl Jones (Talk | contribs) (Created page with "In computer science, a non-strict programming language is a programming language which A non-strict programming language allows the user to define non-strict functions,...") |
Karl Jones (Talk | contribs) |
||
Line 1: | Line 1: | ||
− | In [[computer science]], a non-strict programming language is a programming language which | + | In [[computer science]], a '''non-strict programming language''' is a [[programming language]] which allows the user to define non-strict functions, and hence may allow [[lazy evaluation]]. |
− | + | == Theoretical advantages == | |
− | == Strict == | + | 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. | ||
+ | |||
+ | == Disadvantages == | ||
+ | |||
+ | 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 == | ||
By contrast, a [[strict programming language]] is one in which only strict functions (functions whose parameters must be evaluated completely before they may be called) may be defined by the user. | By contrast, a [[strict programming language]] is one in which only strict functions (functions whose parameters must be evaluated completely before they may be called) may be defined by the user. | ||
Line 10: | Line 24: | ||
* [[Computer science]] | * [[Computer science]] | ||
+ | * Programming language | ||
* [[Strict programming language]] | * [[Strict programming language]] |
Revision as of 15:44, 1 March 2016
In computer science, a non-strict programming language is a programming language which allows the user to define non-strict functions, and hence may allow lazy evaluation.
Theoretical advantages
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.
Disadvantages
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
By contrast, a strict programming language is one in which only strict functions (functions whose parameters must be evaluated completely before they may be called) may be defined by the user.
See also
- Computer science
- Programming language
- Strict programming language