parent cannot be used as an identifier with implicit globals: (stack corruption & improper parsing)
parent = 5 -- bad
assert(_G["parent"] == 5) -- good
assert(_G.parent == 5) -- good
assert(parent == 5) -- bad
parent = nil
parent cannot be used as a local function identifier, but can be used as a local identifier: (inconsistency)
local function parent() -- bad
return 5
end
local parent = function () -- good
return 5
end
print(parent())
parent should also have its purpose narrowed to within classes at a minimum. There is no logic checking for this.
Usefulness, even after it's fixed
In exchange for disallowing 'parent' to be properly used as an identifier inside of classes (or at all, currently), you can use it as a sometimes-shorthand to access the parent whose name you already know and who you can already access through the __parent field.
Issues
parent
cannot be used as an identifier with implicit globals: (stack corruption & improper parsing)parent
cannot be used as a local function identifier, but can be used as a local identifier: (inconsistency)parent
should also have its purpose narrowed to within classes at a minimum. There is no logic checking for this.Usefulness, even after it's fixed
In exchange for disallowing 'parent' to be properly used as an identifier inside of classes (or at all, currently), you can use it as a sometimes-shorthand to access the parent whose name you already know and who you can already access through the
__parent
field.