Page 1 of 1

[V 1.1] Object.Delete(Key) doesn't work in some cases

Posted: 23 Mar 2024, 13:07
by oldbrother
When "Delete" is key of an object, Delete(Key) stops working. Some other key words could have similar issues, but I'm not sure. Please see the details in this thread:

viewtopic.php?f=76&t=127710&p=564519#p564519

I hope this can be fixed!

Code: Select all

#Requires AutoHotkey v1

words := {"AAA": 1, "Delete": 2, "Add": 3, "Hello": 4}
NewWord := "AAA"

words[NewWord] := "5" ; Works
MsgBox % words[NewWord]

words.Delete(NewWord) ; Doesn't work
MsgBox % words[NewWord]

Re: [V 1.1] Object.Delete(Key) doesn't work in some cases  Topic is solved

Posted: 23 Mar 2024, 20:32
by lexikos
This is by design. words.Delete(NewWord) will try to call the function named "2". One of many design flaws of v1 fixed by v2. (You are effectively doing the same as words.Delete := 2, which would also prevent the method from being called in v2. But in v2, an error would be thrown.)

Also, I see you are aware of End of Life: v1.1. The writing has been on the wall for years. I personally have no reason to reconsider, even if someone finds a bug. Someone else can fix their own fork of v1, if they want.

I am locking this topic since it is not a bug and you already have a topic in Ask for Help.