[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [BUG] unsafe metatable paradigm
- From: v <v19930312@...>
- Date: Mon, 24 Jun 2019 20:32:23 +0300
On Mon, 2019-06-24 at 19:16 +0200, Viacheslav Usov wrote:
> I do not think the problem is addressed in the manual (__metatable
> is, in my opinion, not mentioned where it should, nor is its purpose
> stressed at all). With the sample code in PiL and well-known Lua
> libraries having this problem as illustrated above, we seem to have a
> well-established unsafe paradigm and the question is how we can get
> out of this trouble.
>
> Cheers,
> V.
`userdata` object is somewhat "foreign" for Lua: no default operations
can be applied to it: no addition/subtraction/indexing/etc. I
personally think that would make perfect sense to disable its
modification with `getmetatable`/`setmetatable` (keep debug. versions
functional of course), as it isn't Lua-side code business to manage its
internal state (and metatables are part of its internal state).
--
v <v19930312@gmail.com>