Post Reply 
List editor --- strange behaviour
11-21-2023, 05:56 PM
Post: #1
List editor --- strange behaviour
Hello,
the list editor does strange things:
- I create a "List1" and put stuff into it
- To save it, I create a new variable "List2" and store the contents of List1 there
- Both appear in the list editor with correct content
- I point to List1 and "Delete", confirmed with "OK"
- List2 gets deleted, List1 is still there
Is this a bug or is there some logic behind ?
Regards
Andreas
Find all posts by this user
Quote this message in a reply
11-22-2023, 06:22 AM (This post was last modified: 11-22-2023 07:12 AM by komame.)
Post: #2
RE: List editor --- strange behaviour
(11-21-2023 05:56 PM)DG7RBN Wrote:  Hello,
the list editor does strange things:
- I create a "List1" and put stuff into it
- To save it, I create a new variable "List2" and store the contents of List1 there
- Both appear in the list editor with correct content
- I point to List1 and "Delete", confirmed with "OK"
- List2 gets deleted, List1 is still there
Is this a bug or is there some logic behind ?
Regards
Andreas

Have you used the DelHVars command? If so, you must make sure that the variable name is enclosed in quotation marks. If you did DelHVars(list2) instead of DelHVars("list2"), you can indeed experience such behaviors.
The DelHVars syntax allows you to delete multiple variables simultaneously using their indexes. You can see the list of variables by using HVars.

Code:
list1:={1,2,3,4,5}
list2:=list1
HVars

It will return {"list1","list2", ... /other variables you had created/ }
This is a list of variables that you can refer to by name or by index number. However, if you use a list instead of an index number, DelHVars will attempt to delete multiple variables at once, and indeed, in such a case, the behavior of DelHVars may seem a bit strange.

Execute the following sequence of commands:
Code:
list1:={1,2,3,4,5}
list2:=list1
DelHVars({1,2,3,4,5})

This should delete both list1 and list2, but it only deletes one or the other (depending on their order in the list).
Find all posts by this user
Quote this message in a reply
11-22-2023, 09:52 AM
Post: #3
RE: List editor --- strange behaviour
I performed additional tests, and there is indeed a bug that causes the deletion of the wrong variable in the scenario you described (when using "Delete" in "Memory Manager" / "User Variables").
I have reported this in the bug tracker.
Find all posts by this user
Quote this message in a reply
11-22-2023, 11:41 AM
Post: #4
RE: List editor --- strange behaviour
Hi Piotr,
the wrong deletion also happens with the "Delete" function in the list editor. Maybe same root cause.
Did you report it to Jeff's bug tracker ?
Andreas
Find all posts by this user
Quote this message in a reply
11-22-2023, 07:48 PM
Post: #5
RE: List editor --- strange behaviour
(11-22-2023 11:41 AM)DG7RBN Wrote:  the wrong deletion also happens with the "Delete" function in the list editor. Maybe same root cause.

I suspect that variable deletion behaves incorrectly when there are multiple references to the same object in memory. In such cases, it always deletes the last assigned reference.
For example:
Code:
a1:=1
a2:=a1
a3:=a2
a4:=a1
Now, delete any of the variables a1..a3, which will result in the deletion of a4. Then delete another (but not the last one), and another... it will always delete the last variable, not the one you specified.

(11-22-2023 11:41 AM)DG7RBN Wrote:  Did you report it to Jeff's bug tracker ?
Of course, in Jeff's bug tracker.

Piotr
Find all posts by this user
Quote this message in a reply
01-07-2024, 11:31 PM
Post: #6
RE: List editor --- strange behaviour
(11-22-2023 07:48 PM)komame Wrote:  
(11-22-2023 11:41 AM)DG7RBN Wrote:  the wrong deletion also happens with the "Delete" function in the list editor. Maybe same root cause.

I suspect that variable deletion behaves incorrectly when there are multiple references to the same object in memory. In such cases, it always deletes the last assigned reference.

You're very much on the right track! One interaction to try would be the following:
Code:
DelHVars({"a1","a2"})
a1:=1; a2:=1; a1:=a2
& then delete a1.

Quote:
(11-22-2023 11:41 AM)DG7RBN Wrote:  Did you report it to Jeff's bug tracker ?
Of course, in Jeff's bug tracker.

Thanks! The bug has been fixed. Big Grin
Find all posts by this user
Quote this message in a reply
01-07-2024, 11:32 PM
Post: #7
RE: List editor --- strange behaviour
(11-22-2023 11:41 AM)DG7RBN Wrote:  Hi Piotr,
the wrong deletion also happens with the "Delete" function in the list editor. Maybe same root cause.
Did you report it to Jeff's bug tracker ?
Andreas

This bug, too, has been fixed. Big Grin
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)