Re: C API question
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: C API question
- From: liam mail <liam.list@...>
- Date: 2011年1月11日 09:57:50 +0000
On 10 January 2011 18:27, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
> Well, sure, but the whole point was to (a) avoid the registry, and
> (b) reduce the execution overhead. It is a simple pointer offset to
> convert from the userdata block address to the userdata object. A
> supported lua_pushuserdata (or something like that) would save lots
> complexity compared with using the registry, and avoid use of ad hoc
> undocumented mechanisms.
That would create a whole new world of possibilities for dangling
pointers. Lua has a strong principle of avoiding references that
are not accounted for by the garbage collector.
-- Roberto
Devils advocate.
So if a user does not have a pointer to use for a lightuserdata then the library would effectively force the thing which Lua does not want onto the user? IE the need to create a pointer to use for a userdata which the user then needs to track and could be left dangling, this is pretty much the case with ints returned by luaL_ref.
I guess I just do not understand what the problem is with references (that is not already solved) and what benefit would be had from the possibility of removing them.
Liam
- References:
- Re: C API question, joao lobato
- Re: C API question, Roberto Ierusalimschy
- Re: C API question, Mark Hamburg
- Re: C API question, Roberto Ierusalimschy
- Re: C API question, Jerome Vuarand
- Re: C API question, Roberto Ierusalimschy
- Re: C API question, Daniel Silverstone
- Re: C API question, Doug Currie
- Re: C API question, Patrick Donnelly
- Re: C API question, Doug Currie
- Re: C API question, Roberto Ierusalimschy