[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Making lua case insensitive
- From: "John Belmonte" <jvb@...>
- Date: Sat, 9 Dec 2000 10:15:05 +0900
> John Belmonte wrote:
> > 1) make a wrapper for your classes methods that would back up the
> > global table and replace it with your class object. That is, when the
> > calls obj:fullName() it's really first handled by a wrapper that
> > the global table and then calls the actual fullName().
> It seems that the cost of this step would exceed the benefit of the
> Is there some way to avoid this problem?
I don't agree that it would be so bad. One implementation is in the field
fullName you'd have a wrapper object whose "function" event is set to
function wrapper(obj, ...)
local oldtable = globals(obj.locals)
local val = call(obj.realfunc, arg)
This function could be implemented from C.
The thing is, you can do much more with this than just eliminate the self's
in your classes. You could do a mean module system, closures, namespaces...