On Tue, Dec 13, 2005 at 03:32:38AM +0900, ako... wrote:
> > also note that lambda will prevent __everything__ in it's scope from __=
> > being garbage collected.
> could someone please confirm this? i am also interested to know why GC
> is so different in lambdas and whether the objects will be collected
> when lambda itself goes out of scope?
There's nothing different about GC within lambdas. You simply need to
be aware of how lambdas work.
The lambda object needs to maintain references to everything that was
visible within the scope where it was created. As long as the lambda
object is alive, everything it references must also stay alive.
If you allow the lambda object to be garbage-collected, the things it
references will also be subject to garbage collection. =20
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature