docs/semantics/evaluation.md
Enso's evaluation semantics can be succinctly described as 'strict, but with optional laziness'. By default, expressions in Enso are evaluated strictly, but the programmer may choose to 'suspend' computations, and instead evaluate them at the point they are needed.
<!-- MarkdownTOC levels="2,3" autolink="true" --> <!-- /MarkdownTOC -->Though Enso shares many syntactic similarities with Haskell, the most famous example of a lazily evaluated language, Enso is not lazy. Instead, Enso is a language that is strict.
The actionables for this section are:
- Make this far better specified.
Laziness, however, can often be quite useful for defining certain kinds of API.
To that end, Enso provides support for optional laziness, more specifically
optional suspension, through the built-in Suspended type.
a is wrapped in a Suspended, it is turned into a thunk.Suspended a may be forced to execute the suspended
computation and thereby obtain an a.This forcing can take place in two ways:
force : Suspended a -> a on the
value.Suspended a is provided in a location
that expects a value of type a, the compiler will insert an implicit call to
force to produce the a.The actionables for this section are:
- Make this far better specified.