| Bj|rn von Sydow ([EMAIL PROTECTED]) reports that this expression
| runs in constant space
|   mapM_ putStr (repeat "")
| but this program does not:
|   main = mapM_ putStr (repeat "")
| 
| This is caused by "CAF-leaks" - a long-standing problem of most Haskell
| compilers (except HBC?).

I can see why you might be unhappy about this, but I should say that Gofer
(on which Hugs is based) was specifically designed to behave in this way.
It's interesting that Alastair specifically mentions compilers in the
above because, in my view, the requirements change in the context of an
interactive interpreter.  In particular, this feature gives a the same
treatment of variable bindings at the top-level as it does to local
definitions, it allows the construction of values that are memoized across
a sequence of evaluations in a session, and has been quite heavily used by
a number of people as a way of teaching certain concepts (particularly
lazy evaluation).

I can see that t would be useful to have a way of running programs without
the caching of top-level CAFs.  But I think it would be a great pity to
loose this feature altogether.  At the very least, users should have a
command line option so that they can choose which behaviour they need.

All the best,
Mark

Reply via email to