lua-users home
lua-l archive

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


> > Another dimension in this is the present of static objects. 
> When we where
> > running all functions and a lot of global variables would 
> not be touched -
> > So some sort of "disregards from GC" scope could be very 
> interesting,
> 
> This is exactly what a generational collector does: it 
> disregards "old"
> objects (where "old" means the object has been alive and has not
> been modified for a while).
> 
> (Actually, that definition of "old" is a simplification, but that also
> simplifies the implementation of the algorithm.)

But presumably everything has to be checked at somepoint which will result
in the same problems as are being encountered now? Would adding a
"const"/"static" keyword help?
eg.

const function foo() ... end

foo = 1 -- error

You could now move the closure referenced by foo to a "safe" area. I think
this would have 2 benefits. Firstly you wouldnt have to garbage collect the
foo closure as foo would always reference it. Secondly, you could possibly
call it faster as you would not necessary have to hash foo to the object
referenced, it would always reference the same object, so you could give it
a permanent pointer?

I'm not sure if "static" or "const" is the correct keyword here. It would be
static data, but a const reference. Oh, it might not work either... over to
the Lua experts...

Nick