lua-users home
lua-l archive

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


On Sat, 12 Sep 2009 21:30:30 +0300, Mark Hamburg <mark@grubmah.com> wrote:

The garbage collector may also expect that the environment is a table rather than an arbitrary object. That would be the other place to check when making changes.

It looks like it doesn't...

Benchmarks are of course the "right" thing to do. The problem is figuring out what to measure that will be meaningful in a general context.

Important criteria for me is size and complexity of C code. And memory usage.

Personally, on Lightroom, I wished for the ability to store nil in the userdata environment table.

That's harder. Currently it's a pointer to something that can be put in GC
list, which excludes nil, bools, numbers and lightuserdata. Changing that
would be a much bigger patch, and would increase size of userdata header.

However, your comment made me think about what is the default value for
that environment ... and it (obviously) is the currently active
environment.

I don't like that.

It means that every userdata captures a reference to environment, even
if I will not use it. If there is a code that overrides environment
with a temporary table (e.g. to plug some names into global namespace,
or to do something like 'module' does), that table will live as long
as any userdata created by the code that use it.
Even if it is not needed anymore.