AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Var := Var%Num% ... bug? (AutoTrim bug?)

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
Ya-Cha.
Guest





PostPosted: Sun Jan 23, 2005 9:05 am    Post subject: Var := Var%Num% ... bug? (AutoTrim bug?) Reply with quote

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

PostPosted: Mon Jan 24, 2005 12:04 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Gehn



Joined: 03 Mar 2005
Posts: 13
Location: Terminus of Tears

PostPosted: Thu Mar 03, 2005 12:54 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail AIM Address
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Thu Mar 03, 2005 1:05 am    Post subject: Reply with quote

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
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Thu Mar 03, 2005 2:49 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Gehn



Joined: 03 Mar 2005
Posts: 13
Location: Terminus of Tears

PostPosted: Fri Mar 04, 2005 2:28 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail AIM Address
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Fri Mar 04, 2005 2:46 am    Post subject: Reply with quote

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
View user's profile Send private message
Gehn



Joined: 03 Mar 2005
Posts: 13
Location: Terminus of Tears

PostPosted: Fri Mar 04, 2005 3:30 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail AIM Address
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Fri Mar 04, 2005 4:08 am    Post subject: Reply with quote

These ideas should come in handy when the time comes to consider more types of built-in data structures. Thanks.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Bug Reports All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group