$linuxjunkies
>

eager evaluation

also: strict evaluation

Eager evaluation is the immediate computation of expressions when encountered, rather than waiting until their results are actually needed. It's the default behavior in most Linux shells and programming languages.

Eager evaluation means that the system processes and computes values right away, as soon as it encounters them in the code or command. This is contrasted with lazy evaluation, where computation is deferred until the result is actually required.

In a Linux shell context, eager evaluation occurs in command substitution and variable expansion. For example, when you write echo $(date), the date command runs immediately and its output is substituted into the echo command, rather than being evaluated later.

Most programming languages use eager evaluation by default: when you write x = 5 + 3, the addition happens right away and 8 is stored in x. Some languages and tools support lazy evaluation as an optimization, where expressions are only computed when their values are actually used.

Related terms