In essence, declarative languages have not been considered 'industrial strength' languages. This document examines a style of computation typically found in declarative languages, and functional languages in particular, called lazy evaluation . Its mechanics are briefly explained and then its implications are examined in depth. The main thesis of this document is that laziness brings so many benefits to the software development process that it should, inevitably, become an integral part of mainstream programming. When a program executes, computation can generally proceed via different evaluation orders, according to which one of many different evaluation strategies is being pursued.
Functional languages can be eager, lazy or a mix of the two.
Choosing a particular evaluation strategy is not trivial, as the implications are wide-ranging and, in some cases, quite subtle. It affects execution efficiency, programming style, interaction, etc. as discussed below. Programming Style Lazy semantics often allow the solution to a problem to be expressed more naturally and elegantly than eager semantics would permit. In the same way that arguments to a function are only evaluated when required, elements in a list are also only evaluated when required by another function. This technique affords itself to concise and elegant algorithms, particularly when certain mathematical techniques, such as successive refinement, can be expressed very conveniently assuming lazy semantics.