|
Am 23.08.2014 um 07:59 schröbte Coroutines:
On Fri, Aug 22, 2014 at 2:13 PM, Sean Conner <sean@conman.org> wrote:But now you are exposing what has been an implementation detail. The tname just has to be unique, it doesn't have to have any meaning (so I guess the days of #define MY_TYPE "\200\201\202\203\344\377\300" are over) and we run headlong into the namespace problem we (potentially) have with modules, but now with types.
Lua 5.3 sometimes uses the type names of `luaL_newmetatable` in error messages, so it'd better be printable.
I think -- like module names -- people will have to put some thought into their typenames. I would not expect people to pull in libraries introducing a lot of userdata types anyway, I feel like it would be a small concern.
Depends on the C library (and the person who did the binding): I have an incomplete binding to APR (just APR, no APR-Util, no threading, no network io) with 15 different userdata types, and a very incomplete binding to SDL with 17 different userdata types. But I tend to use userdata for some enums/flags for increased type safety ...
Philipp