I must fork all of the glibc versions before I go completely academic
I can't even stand non-LISPs' lack of first class and anonymous functions anymore ;_;
Name:
Anonymous2012-09-01 15:41
>>4
lua is just a little bit more far out than javascript.
function caching_inherit(self, ...)
local parent_classes = {...}
local cache = {}
local meta = {__index = function(self, k)
local cached_value = cache[k]
if cached_value ~= nil then
return cached_value
else
for _, parent_object in ipairs(parent_classes) do
local parent_value = parent_object[k]
if parent_value ~= nil then
cache[k] = parent_value
return parent_value
end
end
end
end}
setmetatable(self, meta)
return self
end
A = {a='A.a', b='A.b', c='A.c'}
B = {b='B.b', x='B.x'}
C = {c='C.c'}