Hi Christopher,
> Hi list, could someone educate me a little regarding the following (or
> point me to the right documentation):
>
> Say I have function
>
> (foo (Lst)
> (bar (copy Lst)) )
>
> My question is: At the point when bar is called, is Lst now gone (i.e.,
> marked for garbage collection) or does that wait until bar returns? If
Neither. It depends on who else "owns" this list. Consider
(let L (range 1 99)
(foo L)
(print L) )
At first only 'L' points to the list (to the first cell, to be exact).
When (foo L) is called, now also 'Lst' points there. 'foo' has no influence on
that. It could be defined as
(de foo (Lst)
(let A (bar (copy Lst))
(off Lst)
(doSomethingWithTheCopy)
...
With (off Lst) *one* refernce to the list is cleared, but the list will be
garbage collected only when the *last* reference is gone, which is not under
control of 'foo'.
If the list could indeed be garbage collected inside 'foo', then the above
(print L) would crash terribly.
♪♫ Alex
--
UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe