| View previous topic :: View next topic |
| Author |
Message |
Piz
Joined: 16 Feb 2008 Posts: 46
|
Posted: Sun Mar 23, 2008 10:04 pm Post subject: LOCAL Syntax Change |
|
|
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 |
|
 |
Tuncay
Joined: 07 Nov 2006 Posts: 383 Location: Berlin
|
Posted: Mon Mar 24, 2008 4:32 pm Post subject: |
|
|
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.  |
|
| Back to top |
|
 |
Piz
Joined: 16 Feb 2008 Posts: 46
|
Posted: Mon Mar 24, 2008 6:21 pm Post subject: |
|
|
| 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. 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 |
|
 |
|