On Feb 12, 2006, at 6:05 AM, Gavin Kistner wrote:
Bah, I forgot to assign that function to anything, AND I'd need to save/restore those variables for stack-based calls/exits.
function AKClass.prototype:addMethod( inName, inFunc )
local theClass = self.class
self[ inName ] = function( ... )
local oldSuper, _super = _super, theClass.superClass
local oldMethodName, _methodName = _methodName, inName
local theReturnValue = inFunc( unpack( arg ) )
_super, _methodName = oldSuper, oldmethodName
return self[ inName ]
Definitely not something I'd consider implementing if either speed or memory were tight, but a fun mental exercise in pure hackery, nonetheless.