lua-users home
lua-l archive

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


hi there! :)

Sergey Kovalev:
> __unreference should call immediately when reference count to zero,
unliket __gc it is called latter then there is no way to stand more or
when explicitly call collectgarbage()

hmmm, maybe we are talking about the same here, but if not, then what
about optional refcount instead of `<toclose>`?!

that way its just a matter of an entry in the metatable, and it isnt
bound to the variable, so there is no need for the whole `<toclose>`
misery (in the sense, that it opened a large can of worms on lua-l). a
lotsa ppl use their own refcount implementations for a bunch of
things, and that have a much more wide area for its use-cases, but it
can achieve the same as `<toclose>` just as well. (if im right. :D )

i think it could be simply called to `__refcount` and it could be
`nil` or `false` for disabling it (so it will wait for the gc), a
number that would be handled internally, but ppl could also mess with
it, or a function could get it from anywhere without an argument or
set it with an argument.

actually i would be much more happy with such a feature, but whatever,
decide wisely, like u did so far now! :)

bests! :)