[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Strong tables in Lua 5.4
- From: pocomane <pocomane_7a@...>
- Date: Tue, 27 Mar 2018 14:30:27 +0200
On Tue, Mar 27, 2018 at 12:58 PM, Eric Man <meric.au@gmail.com> wrote:
> Yes "strong"is too long - what I meant was your original proposal of using
> setmetatable and __mode - it morphed into "make every table a strong one" so
> I wanted to bring the discussion back to this; I think it's a good proposal
> and I haven't read any good technical arguments against it yet.
>
Let `set_strong_mode` be a wrapper to set the metamethod to anything
we need to make it strong. Then consider the following code:
```
local tab = {}
local key = {}
tab[key] = true
set_strong_mode(tab)
tab[key] = nil
key = nil
```
Now, how I can delete the table content?
Yes you can suppose that when set back to "Normal" mode, the key
should be collected, But this means that the set of a metamethod field
should trigger a table iteration. I did not find yet a nice way to
solve this issue...
- References:
- Strong tables in Lua 5.4, Dirk Laurie
- Re: Strong tables in Lua 5.4, Philipp Janda
- Re: Strong tables in Lua 5.4, Hisham
- Re: Strong tables in Lua 5.4, Roberto Ierusalimschy
- Re: Strong tables in Lua 5.4, Egor Skriptunoff
- Re: Strong tables in Lua 5.4, Roberto Ierusalimschy
- Re: Strong tables in Lua 5.4, Hisham
- Re: Strong tables in Lua 5.4, Italo Maia
- Re: Strong tables in Lua 5.4, Eric Man
- Re: Strong tables in Lua 5.4, Dirk Laurie
- Re: Strong tables in Lua 5.4, Eric Man