[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: rethinking method calls with __mcall metamethod rather than __index/__call
- From: Mark Hamburg <mark@...>
- Date: Sat, 13 Jun 2009 22:31:08 -0700
The reason I went for making mcall return the function and its first
parameter had to do with the underlying behavior of the Lua virtual
machine and with the needs for implementing method curries. If we
insist that the SELF opcode always generates the object to call and
the first parameter to the call, then everything after that is well
positioned for reasoning about the state of the stack for a call or
for building a method curry. The __mcall metatable entry is basically
a way to override this behavior. We could say that it only gets to
return the item to call, but that seems overly restrictive.
Mark