Strict semantics

From HaskellWiki
Revision as of 05:45, 1 January 2025 by Atravers (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

(As opposed to non-strict semantics.)

In programming languages that use strict semantics, an undefined argument of a function leads to an undefined function result. This happens even if the argument's value isn't needed by the function:

∀ f . f undefined = undefined

As a result, the if ... then ... else ... conditional usually requires additional support from such languages to work correctly - evaluate the condition, then the selected alternative (not both of them).

It may be implemented by eager evaluation. Examples of programming languages which use strict semantics include OCaml and LISP.