lua-users home
lua-l archive

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


On Tue, Apr 22, 2014 at 8:22 AM, Coroutines <coroutines@gmail.com> wrote:
> I still don't know what's going on this thread, but for the sake of
> variety -- light, shallow, and full userdata :p

Man, it took me a while in the beginning to understand the difference
between light and full, but it's easy enough: light is just a pointer,
and all light userdata share the same metatable (like strings, etc);
full metadata can have individual metatables.  Now imagine writing the
manual to explain the meaning of 'shallow' ;)

The trouble is that it's very common to wrap a C/C++ pointer in a
small full userdata type (pointer to pointer) which is wasteful if
you're really worried about all these extra objects needing to be
GC'd.  (My question would be: yes, but it does it make much difference
in real projects?)

Peng Zhicheng has provided a patch which is less wasteful but provides
a (few) extra type slots. A patch is certainly the most sincere of
feature proposals, and now people can try it out and see if it makes
their life easier.

But conceptually, three is a much larger number than two...