lua-users home
lua-l archive

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


On Wed, Sep 30, 2015 at 02:18:39PM +1000, Daurnimator wrote:
> 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.
> 

d'oh. I totally forgot about metatable names in the registry. Although it's
just like the conflict with regular module names, in Lua or any other
language.

> e.g. I have a userdata that contains a sigset_t
> (https://github.com/daurnimator/lua-spawn/blob/master/spawn/sigset.c),
> I chose to use the string "sigset_t" in the registry for it.
> 
> I'm not yet sure if this idea is brilliant or stupid...

I use sigset_t for my Lua Unix module :) Perhaps I should start using
prefixes. Although our definitions are identical so the conflict is benign.