[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: when do programs set metatable?
- From: Roberto Ierusalimschy <roberto@...>
- Date: Sat, 9 Feb 2008 11:58:51 -0200
> On manual finalization (something like fh:close()) I reset the metatable
> of that userdata to nil ("I'm done with it - never wanna see it again.").
That would not be a problem. What would be a problem is the reverse,
to put a metatable (with a __gc) into a userdata that did not have a
metatable (or that had a metatable without a __gc).
(Moreover, Mike Pall's suggestion (of turning to the current behavior if
the search gets too long) seems a nice compromise to avoid worst-case
behavior even in that situation.)
-- Roberto