[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Method dereferencing protection
- From: Peter Shook <pshook@...>
- Date: Mon, 18 Aug 2003 23:45:52 -0400
Mark Hamburg wrote:
Looking at the VM and the compiler, I'm guessing that the colon always goes
through OP_SELF and essentially nothing else does? Is this correct?
Yes, I think so.
If so, could one teach OP_SELF to look for another metatable entry -- e.g.,
__self -- in addition to __index? That way, one could put the "I only want
to be used in a colon-operator call" C functions in the __self table and be
assured that they were being used with the right datatype?
Or is there more that would need to be done? (I know that TM_SELF would
probably need the same optimizations as TM_INDEX.)
Is this a reasonable proposal?
I've experimented with this idea too. There is a patch at the bottom of
my wiki page: