[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Feature request: userdata slice
- From: William Ahern <william@...>
- Date: Thu, 20 Aug 2015 18:27:28 -0700
On Fri, Aug 21, 2015 at 12:55:46AM +0200, Philipp Janda wrote:
> Am 21.08.2015 um 00:21 schröbte Rena:
> >On Aug 20, 2015 6:05 PM, "Roberto Ierusalimschy" <roberto@inf.puc-rio.br>
> >wrote:
> >>if we want to put some extra bits in
> >>'TValue' to good use and solve the OP problem, maybe a better idea would
> >>be to introduce metatables for light userdata.
> >
> >That would be excellent. I find it difficult to find much real use for
> >light userdata with only a single global metatable.
>
> That would be another welcome feature, but lightuserdata pointing into full
> userdata is unsafe: the full userdata could be collected without the
> lightuserdata realizing/preventing that.
You wouldn't do that. You would store the reference to the full userdata in
the metatable, not as the lightuserdata value. The lightuserdata would only
contain the offset. That would require only one unique metatable per full
userdata, not per lightuserdata proxy.
- References:
- Re: Feature request: userdata slice, 云风 Cloud Wu
- Re: Feature request: userdata slice, Dirk Laurie
- Re: Feature request: userdata slice, 云风 Cloud Wu
- Re: Feature request: userdata slice, Dirk Laurie
- Re: Feature request: userdata slice, Dirk Laurie
- Re: Feature request: userdata slice, Tim Hill
- Re: Feature request: userdata slice, William Ahern
- Re: Feature request: userdata slice, Roberto Ierusalimschy
- Re: Feature request: userdata slice, Rena
- Re: Feature request: userdata slice, Philipp Janda