You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
but it's a huge issue with the way local declarations are currently handled. Consider this test:
x = 1
function f()
local x = 2
end
f()
return x
Because of how locals are implemented, they just reside in a table. The local x = 2 assignment desugars to local x; x = 2, but with the new nil assignment rules (setting to nil deletes the key), the first statement doesn't do anything.
This is the code I tested with (Util.hs):
setTableField tRef (k, Nil) = LuaMT $ tables . at tRef . traversed . mapData %= delete k
I'm not sure how important this is, frankly. I mean, of course leftover nils are going to be a problem at some point, but it's not like you can clear a local def anyway, and it's not observable in tables unless native api is used. Fixing it would require changing the way local closures are stored, or at the very least give them a bypass that allows setting them to nil for the purpose of tracking keys.
The text was updated successfully, but these errors were encountered:
but it's a huge issue with the way local declarations are currently handled. Consider this test:
Because of how locals are implemented, they just reside in a table. The
local x = 2
assignment desugars tolocal x; x = 2
, but with the newnil
assignment rules (setting to nil deletes the key), the first statement doesn't do anything.This is the code I tested with (Util.hs):
I'm not sure how important this is, frankly. I mean, of course leftover nils are going to be a problem at some point, but it's not like you can clear a local def anyway, and it's not observable in tables unless native api is used. Fixing it would require changing the way local closures are stored, or at the very least give them a bypass that allows setting them to
nil
for the purpose of tracking keys.The text was updated successfully, but these errors were encountered: