4 ms·
> Lazy evaluation is an option in the design space of programming languages, and one that is rather exotic due to its complications. It definitely requires con
by munk-a 5y ago
> Lazy evaluation is an option in the design space of programming languages, and one that is rather exotic due to its complications.
It definitely requires control of the data - i.e. having a partially evaluated linked list somewhere directly accessible by pointer without signaling any generating function will break a lazy implementation. That said I absolutely love lazy evaluation and have built a lot of tools in less functional languages like PHP and C++ for handling very large data sets.
When dealing with large report generation (i.e. all transactions from a quarter compiled for the accounting department) it can be necessary to avoid ever actually realizing full data sets into memory for efficiency and capacity reasons - that's an area where abstractly defining various transformations on the result set and then executing them in an iterative or batched manner can be exceedingly useful. I have killed many OOMs in my days.