lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, Aug 1, 2014 at 12:25 PM, Coda Highland <chighland@gmail.com> wrote:
> On Fri, Aug 1, 2014 at 12:16 PM, Thiago L. <fakedme@gmail.com> wrote:
>>
>> On 01/08/14 04:13 PM, Coda Highland wrote:

> I have no idea if this would actually work or not, but it's the kind
> of thing I'm talking about. O(1) behavior for the clear() operation
> itself, and the GC goes about its business the normal way.

In Lua we invisibly deal with a reference to the table.  What he's
saying is Lua could internally create a separate table and pair up the
reference we use with the new table it constructed, and "forget" the
old one with the GC.  My only issue is I'd want to new table to
"inherit" the metatable of the old one.  This would be quite fast
otherwise...  I'm not familiar with the C object used for representing
tables so I'm hoping that code he wrote is accurate. :-)