[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Why is "gc" tag method restricted to userdata?
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Fri, 6 Oct 2000 19:18:27 -0300 (EST)
>By setting "gc" tag methods on the userdata, I get a chance to delete
>the C++ objects, but I'm not guaranteed that the tag methods are
>called in any particular sequence.
In 4.0, GC tag methods for userdata are called in decreasing order of tags.
We'll say so in the manual for 4.0 final.
>I believe that in 3.2 you could set "gc" tag methods for tables. Am
>I correct ?
Yes, but we removed this "feature" because they open the way to subtle bugs.
For instance, could you access the fields of the table during GC? Could you
write to them? Could you create a reference to the table or one of its fields?
GC tag methods should only be needed for userdata, so that's the only case
allowed in 4.0; moreover, you can only write GC tag methods in C.
--lhf