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 

LOCAL Syntax Change

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
Piz



Joined: 16 Feb 2008
Posts: 46

PostPosted: Sun Mar 23, 2008 10:04 pm    Post subject: LOCAL Syntax Change Reply with quote

If it's feasible, I'd like to see the following two lines become equivalent:
Code:
LOCAL a := 1, b := 1
LOCAL a := b := 1

As it is now, in the first line b becomes a local variable, in the second it doesn't.
Back to top
View user's profile Send private message
Tuncay



Joined: 07 Nov 2006
Posts: 383
Location: Berlin

PostPosted: Mon Mar 24, 2008 4:32 pm    Post subject: Reply with quote

This may breake any script:

Code:
b=2
t()
MsgBox %b%
t()
{
    GLOBAL
    LOCAL a := b := 1
}

In this example "a" would created as a "local" getting the content of "b", which is "1" and what you want. But don`t forget about that "b", which is not local. "b" could be a global variable.

I would see the change to work like expected also. Wink
Back to top
View user's profile Send private message Send e-mail
Piz



Joined: 16 Feb 2008
Posts: 46

PostPosted: Mon Mar 24, 2008 6:21 pm    Post subject: Reply with quote

Tuncay wrote:
This may breake any script:

Code:
b=2
t()
MsgBox %b%
t()
{
    GLOBAL
    LOCAL a := b := 1
}

In this example "a" would created as a "local" getting the content of "b", which is "1" and what you want. But don`t forget about that "b", which is not local. "b" could be a global variable.

Hence the "if it's feasible" in my post. Smile On its own, it's just a matter of being careful about what's local and what's global, which is something anyone must be mindful of anyway. If people are counting on the current behavior, meaning that scads of code would break with the change, that's a different matter.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List 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