Naming conflict between local and global variables

Bugs will be moved here once resolved.

Post » Sat Mar 10, 2012 1:20 am

Details:
Local variables in other event sheets can create naming conflicts with global variables.

Specs:
Intel Centrino
Construct 80.2 (32-bit)
Windows XP SP3


Steps:
1. Create EventSheet1
2. Create Group Group1
3. Create any subevent
3. Add local variable var1 to Group1
4. Create EventSheet2
5. Create global variable Var1

The name 'var1' is already used in this scope.

Notes:
I wouldn't imagine local vars and global vars are supposed to conflict since they have different scopes.

-- cacotigon
B
30
S
6
G
8
Posts: 232
Reputation: 6,119

Post » Sun Mar 11, 2012 7:34 pm

This is by design - they do conflict.

If you can add a global variable with the same name as a local variable, then imagine you typed that name somewhere in the scope of the local variable - it could refer to either! To prevent this problem, variables also cannot use the names of any variables beneath their scope.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Sun Mar 11, 2012 9:36 pm

oh right, that makes sense.

Thanks,
-- cacotigon
B
30
S
6
G
8
Posts: 232
Reputation: 6,119


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 0 guests