lua-users home
lua-l archive

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


On 30 September 2015 at 14:50, Sean Conner <sean@conman.org> wrote:
> It was thus said that the Great Daurnimator once stated:
>> On 30 September 2015 at 14:01, William Ahern <william@25thandclement.com> wrote:
>> > I've never encountered naming conflicts when using the registry.
>>
>> I haven't seen one in practice **yet** but I do think about it.
>>
>> I like the idea of matching C typedefs to metatable keys (as used by
>> luaL_newmetatable, luaL_checkudata, etc).
>> The hope actually *being* that other modules might use it too.
>> This way another person may create their own sigset_t containing
>> userdata, but can still use my functions.
>
>   Hmm ... interesting.  But it's predicated on similar usage to fully work.
> Yours [1] and mine [2] take different approaches to the implementation.  You
> have explicit functions to add and remove sets, whereas I took a more
> value-meta-table approach to it.

That shouldn't matter: the user picks which API they want.

The key thing I counted on is that we have the same **ABI** per registry key.
i.e. that `sigset_t *set = luaL_checkmeta(L, n, "sigset_t")` will
always result in a valid sigset_t pointer.