Summary
This chapter has compared the functional and imperative programming
styles. They differ mainly in the control of execution (implicit in
functional and explicit in imperative programming), and in the
representation in memory of data (sharing or explicitly copied in the
imperative case, irrelevant in the functional case). The
implementation of algorithms must take account of these differences.
The choice between the two styles leads in fact to mixing them. This
mixture allows us to clarify the representation of closures, to
optimize crucial parts of applications, and to create mutable
functional data. Physical modification of values in the environment
of a closure permits us to better understand what a functional value
is. The mixture of the two styles gives powerful implementation
tools. We used them to construct potentially infinite values.