[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: table.insert/remove and metatables
- From: "Alex Davies" <alex.mania@...>
- Date: Sat, 5 Jul 2008 15:16:16 +0800
Dr. Markus Walther wrote:
Question: Shouldn't table.insert/remove respect metatables (__index,
__newindex) for reasons of symmetry and principle-of-least-surprise?
I've always thought the above. I think it's left around from old versions of
Lua before metatables. Personally I'd prefer that everything respected them,
from ipairs (should use __index) through to table.sort. Especially seeing as
the speedup is minimal by performing raw access. Would make making proxy
tables a lot easier, and as for compatibility, I'd say using these functions
to deliberately avoid metamethods seems like incorrect use imo. My 2c :).
- Alex