[Haskell-cafe] Re: Laziness leaks
Albert Y. C. Lai
trebla at vex.net
Wed Jun 4 14:52:12 EDT 2008
apfelmus wrote:
> I haven't heard the terms "laziness leak" and "strictness leak" before,
> imho they sound a bit spooky because it's not clear to me what the
> situation without leak would be. (Time vs Space? Is an O(n) algorithm a
> strictness leak compared to an O(log n) algorithm?)
"Leak" refers to a surprise. You didn't expect Firefox to use Omega(n)
memory where n is the number of times you refresh a rather plain static
HTML page, but it does, and you call it a memory "leak". You didn't
expect foldl to lump a big thunk, but it does, and you call it a lazy
"leak". Therefore "leak" refers to a program failing your expectation -
even if you yourself wrote the program.
("Leak", "bug", "issue"... We surely are very creative in how to avoid
calling a shovel a shovel, or an error an error.)
The solution is better education, better reasoning, and Intelligent
Design. As you write every line of code, you should already know what to
expect. No magic, no surprise, just science.
More information about the Haskell-Cafe
mailing list