lemur
lemur copied to clipboard
Instance properties should return new objects every time
Roblox types override __eq
. This is sort of fine, but accessing properties on instances creates Lua versions of those values every time, which means they aren't rawequal
and also don't hash the same! This is especially surprising for things like signals on instances that don't ever change.
This was a Lemur difference that caused a real bug in Roact. Basically:
local signalMap = {}
local part = Instance.new("Part")
signalMap[part.Changed] = "foo"
print(signalMap[part.Changed]) -- "foo" in Lemur, nil in Roblox
How do you expect the code for this to be written without a major overhaul?
No idea. Maybe this is a problem that stays mostly unsolved, since it's an edge of Roblox that I'm sure is subject to randomly change.
Yeah I'm a bit hesitant about replicating undocumented behavior as well, especially on something that'd need a code overhaul like this.