First of all, thanks to the people who responded :)
On Sat, 14 Aug 2010, Tako Schotanus wrote:
I was reading this article:
http://scienceblogs.com/goodmath/2009/11/writing_basic_functions_in_has.php
And came to the part where it shows:
> fiblist = 0 : 1 : (zipWith (+) fiblist (tail fiblist))
But then I read that "Once it's been referenced, then the list up to where you looked is concrete - the
computations won't be repeated."
It is so implemented. If you *really* wanted a weak reference that could be
garbage collected and rebuilt (you don't), it could be made to happen.
This is true in any programming language or runtime. Nothing special
and I started wondering how that works.
Because this seems to mean that functions could have unknown (to the caller) memory requirements.
has happened: you could implement the same thing in C/C++/Java/Python,
but it would take 10-100 lines of code.
Haskell is garbage collected, as soon as the fiblist is not longer reachable,
How does one, programming in Haskell, keep that in check?
And when does that memory get reclaimed?
and the runtime wants to reclaim the memory, it will.
If fiblist is a top-level declaration it will always be reachable.