|
Markus Heukelom wrote:
However, I agree this might have some other (ugly) repercussions notimmediately obvious at this moment.(In fact, to implement this behavior, I would have to change the __newindex methods of the nil, number, string, etc matetable (can only in c), right? Not that I will do that - just for the idea.)
Apart from whether it's possible to set a metatable for nil (never tried), note that you'd only be able to do this for scalars, i.e. not for tables and userdata, because there's no `global' metatable for these types.
About this concept in general, I don't think it would fit Lua very well. PHP allows it, and that's caused me a few hard to find bugs.
- Peter Odding