[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: advice needed: OO style
- From: Roberto Ierusalimschy <roberto@...>
- Date: Sat, 30 Apr 2011 19:31:27 -0300
> privateData = setmetatable( {}, { __mode = 'kv' } )
>
> x = { }
> xprivate = { public = x }
> privateData[ x ] = xprivate
>
> -- Now drop the references...
>
> x = nil
> xprivate = nil
>
> The values still live forever because of the reference from
> privateData even though nothing can ever reach those values.
That is not true. next(privateData) will return both 'x' and 'xprivate'.
-- Roberto
- References:
- Re: advice needed: OO style, Lorenzo Donati
- Re: advice needed: OO style, Emmanuel Oga
- Re: advice needed: OO style, Mark Hamburg
- Re: advice needed: OO style, Lorenzo Donati
- Re: advice needed: OO style, Emmanuel Oga
- Re: advice needed: OO style, uki
- Re: advice needed: OO style, Henk Boom
- Re: advice needed: OO style, Mark Hamburg
- Re: advice needed: OO style, Lorenzo Donati
- Re: advice needed: OO style, Mark Hamburg