"Bug" in dictionary updates.

33 views
Skip to first unread message

norman bond

unread,
Nov 25, 2025, 12:28:30 PM (9 days ago) Nov 25
to Automate for Android
I don't  know if this is a bug or feature! I use variable set to set a dictionary = an existing dictionary, if I then .make a change to the new dictionary it also changes the original one, so seems to create a link rather than a new copy.

Version 1.48.2
Phone Samsung a16, 
Android 15

Henrik "The Developer" Lindqvist

unread,
Nov 25, 2025, 2:19:21 PM (8 days ago) Nov 25
to Automate for Android
Indeed, that how variables work. Use the copy function to make a copy of an value.

norman bond

unread,
Nov 25, 2025, 2:36:17 PM (8 days ago) Nov 25
to Automate for Android
That doesn't  sound right, and isn't true for other Variables.
Var a = 1
Var b = var a
Var b = 2
Var a is still 1.

But
Dir a = {"x"=1}
Dir b = dir a
Put dir b key "x: = 9
Dir a and dir b  now  {"x"=9}

Henrik "The Developer" Lindqvist

unread,
Nov 25, 2025, 3:00:22 PM (8 days ago) Nov 25
to Automate for Android
Sorry, i gave an incomplete answer.
Indeed, when a variable is assigned a Number or Text there's no "copying", any other type of value, i.e. Array or Dictionary, is assigned a "reference" to it.
Also, each Fiber that's started by an Flow beginning or Fork block each have separate copies of the variable values.

norman bond

unread,
Nov 25, 2025, 4:14:29 PM (8 days ago) Nov 25
to Automate for Android
Thank you. I knew about fibers having own copy.
I was testing this because I want to find a simple way to detect 
changes made in values in one copy but not the other. What is the best way?

Henrik "The Developer" Lindqvist

unread,
Nov 25, 2025, 4:24:05 PM (8 days ago) Nov 25
to Automate for Android
Currently the equal = operator compares the Array/Dictionary references, not their content. Changing it to compare by value is a feature on the to-do list.
A workaround is to compare them as JSON, e.g. jsonEncode(dictA) = jsonEncode(dictB)

norman bond

unread,
Nov 26, 2025, 6:00:17 AM (8 days ago) Nov 26
to Automate for Android

Thanks for the json tip. Looks like I'll have wait for the feature change
 And in meantime  check each key/value in a loop.
Reply all
Reply to author
Forward
0 new messages