| View previous topic :: View next topic |
| Author |
Message |
Ya-Cha. Guest
|
Posted: Sun Jan 23, 2005 9:05 am Post subject: Var := Var%Num% ... bug? (AutoTrim bug?) |
|
|
Sorry, I'm poor at English.
| Code: | AutoTrim, OFF ;for Var7, Var9
;AutoTrim, ON ;for Var8
Var1 = ABC
Var2 = XYZ
Num = 2
XYZ = 100
Var3 := Var%Num%
Var4 := Var1 Var2
Var5 := Var1 Var%Num%
Var6 := "ABC" Var%Num%
Var7 := Var%Num% " 12345"
Var8 := Var%Num% " 12345" Var1
Var9 := Var%Num% " 12345"
Var0 := Var2 " 12345"
MsgBox, 3: %Var3%`n4: %Var4%`n5: %Var5%`n6: %Var6%`n7: %Var7%`n8: %Var8%`n9: %Var9%`n0: %Var0% | XP Pro SP1, AHK ver 1.0.25.05 |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Mon Jan 24, 2005 12:04 am Post subject: |
|
|
Thanks for reporting this. I think these problems have been fixed. You probably know that since arrays and other references cannot be concatenated with other items, they will be treated as blank items.
Changelog items for this topic:
Fixed the fact that an expression such as Var:=" string " would obey AutoTrim while a more complex expression would not. By design, AutoTrim should never affect expressions.
Fixed expressions so that concatenating a reference such as Array%i% always treats Array%i% as an empty string, as documented.
Thanks. |
|
| Back to top |
|
 |
Gehn
Joined: 03 Mar 2005 Posts: 13 Location: Terminus of Tears
|
Posted: Thu Mar 03, 2005 12:54 am Post subject: |
|
|
Are there any plans to allow concatenation with arrays eventually? It's something I'd really like to see. _________________ The dumber people think you are, the more surprised they're going to be when you kill them. |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Thu Mar 03, 2005 1:05 am Post subject: |
|
|
| I think actual arrays should be implemented before we think about making them more "official"; we have loops and such to work with them, but real arrays only exist as a concept in AutoHotkey. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Thu Mar 03, 2005 2:49 am Post subject: |
|
|
| Gehn wrote: | | Are there any plans to allow concatenation with arrays eventually? | Yes, concatenation with both arrays and subexpressions is planned, hopefully soon.
| jonny wrote: | | I think actual arrays should be implemented | I think conceptual arrays are worse than real arrays only in terms of performance and memory usage, and even then the difference might not be large for typical uses. Multi-dimensional arrays are already possible, though one downside is that they can't be destroyed once created.
So this is a good thing to keep in mind for the future. |
|
| Back to top |
|
 |
Gehn
Joined: 03 Mar 2005 Posts: 13 Location: Terminus of Tears
|
Posted: Fri Mar 04, 2005 2:28 am Post subject: |
|
|
Well, a nice way to be able to clear many variables at once would be if a wildcard could be used in an assignment statement. Then, you could clean up an array using something like 'myArray[*] = '. This would also be nice for modules, because if you wanted a whole module to clean up after itself, you wouldn't have to make sure to empty each variable individually, you could just do something like 'myModule_* = '.
If you wanted to get really fancy, something like 'myArray[{1..99}] := "Hi!"' could be used to initialize 'myArray[1]' through 'myArray[99]' with 'Hi!' _________________ The dumber people think you are, the more surprised they're going to be when you kill them. |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Fri Mar 04, 2005 2:46 am Post subject: |
|
|
| Those kind of things need actual arrays to work. It would be simpler to implement real arrays before implementing such things, not only to avoid redundant work but also to avoid confusion. |
|
| Back to top |
|
 |
Gehn
Joined: 03 Mar 2005 Posts: 13 Location: Terminus of Tears
|
Posted: Fri Mar 04, 2005 3:30 am Post subject: |
|
|
I don't see why those things need actual arrays. I could see how implementing real arrays could possibly make the task easier, but since you can mimic the numbered behavior using a loop with already existing commands, it hardly seems necessary to have real arrays. Besides, the ideas have ramifications beyond arrays, which could also be done with normal loops if there was a way to read the variable list. In both cases, the single statement is just nicer. _________________ The dumber people think you are, the more surprised they're going to be when you kill them. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Fri Mar 04, 2005 4:08 am Post subject: |
|
|
| These ideas should come in handy when the time comes to consider more types of built-in data structures. Thanks. |
|
| Back to top |
|
 |
|