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
If you have a Arc<Mutex<A>> and that you want to modify the field c you would do something like:
a.b.c="new string"
BUT, this actually won't work, because what is happening behind the scene is __indexing a with b, BUT you're __newindexing b with - therefore - the cloned b.
Therefore, it won't work. And even more than that, it will clone some unnecessary data that is not needed in this case.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Following #546 (reply in thread)
Let's say that I have 2 depth of UserData like:
If you have a
Arc<Mutex<A>>
and that you want to modify the field c you would do something like:BUT, this actually won't work, because what is happening behind the scene is
__index
inga
withb
, BUT you're__newindex
ingb
with - therefore - the clonedb
.Therefore, it won't work. And even more than that, it will clone some unnecessary data that is not needed in this case.
Do any of you have a clean solution for this ?
Minimal example:
Beta Was this translation helpful? Give feedback.
All reactions