Why is there a space leak here?
Fergus Henderson
fjh@cs.mu.oz.au
Wed, 6 Jun 2001 06:32:12 +1000
David Bakin <davidbak@cablespeed.com> wrote:
> I have been puzzling over this
> for nearly a full day (getting this reduced version from my own code
> which wasn't working).
and Alastair Reid <reid@cs.utah.edu> replied:
> Executive summary: David's program has an incredibly subtle space leak
> in it (or I'm being incredibly dumb).
I don't think you were being dumb. The space leak was easy enough to
understand once explained, but I don't think it was obvious -- at any
rate it was not obvious to me.
I take this as another data point showing how lazy evaluation can cause
space leaks that are difficult to debug. If experts like Alastair Reid
have trouble understanding the operational behaviour of simplified
examples like this one, how are ordinary programmers to cope with
complicated programs? Is lazy functional programming too difficult for
ordinary mortals?
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.