lua-users home
lua-l archive

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

There are certainly arguments for a metamethod that gets invoked on every write instead of just on writes to undefined keys. Many use cases would seem to benefit from the encapsulation this provides. I also suspect that in the cases where one would be likely to use this, the write frequency would be far lower than the read frequency and hence making writes slower in exchange for reads that can bypass the __index metamethod might be a win.

But I also assume that this was all considered when __newindex was chosen, so there are presumably arguments for the way it works now as well.