lua-users home
lua-l archive

Re: rethinking method calls with __mcall metamethod rather than __index/__call

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


On Sat, Jun 13, 2009 at 7:09 PM, David Manura wrote:
> However, the proxy example, in which __mcall will be a function,
> involves a temporary closure again, and we prefer to be able to omit
> the "o" value above too:
Even more so, consider the case in [5] where the proxy forwards its
messages to multiple destinations. Under the original __mcall
semantics, we would write simply
 function mt.__mcall(self, k, ...)
 print('DEBUG-TRACE', self, k, ...)
 for i,v in ipairs(self) do self[i] = v:[k](...) end
 return self
 end
[5] http://lua-users.org/lists/lua-l/2009-05/msg00479.html

AltStyle によって変換されたページ (->オリジナル) /