4 ms·
Array holes can be quite nasty, as they lead to incorrect return values for the length operator. Protecting individual tables with a custom solution, on top of
by vor_ 13y ago
Array holes can be quite nasty, as they lead to incorrect return values for the length operator. Protecting individual tables with a custom solution, on top of prohibiting undefined globals, naturally makes one wonder why the language doesn't behave this way natively. Lua is praised for being unafraid to break backwards compatibility in major releases because embedders can retain their existing versions of the codebase indefinitely. This seems like an opportunity for a future version.
- justincormack 13y agoIt doesnt because there are cases when you want that behaviour and the language gives you tools not policy. In a serious project pretty much every table will have a metatable anyway.