[done!]variable environment release too early when ExitApp

Report problems with documented functionality
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: [done!]variable environment release too early when ExitA

22 Sep 2014, 02:35

One more notice, cant use the static the same name as class!
Sure you can. But you can't refer to two variables with the same name in the same function.
static a:=a wrong
Both as refer to the same variable. If you enable #Warn, it will show you your mistake.
Warning: This variable has not been assigned a value.

Specifically: a (a static variable)

Line#
012: ObjRawSet(b,"bs",("B"))
---> 017: a:=a,sb:=b.bs
022: ObjRawSet(a,"as",("A"))
009: o := new c
010: ExitApp
015: {
018: MsgBox,a.as "," sb
019: }
024: Exit

For more details, read the documentation for #Warn.
Need I report this bug?
If you're going to ask a question, WAIT FOR THE ANSWER. It's not a bug. Also,
To you, I wrote: Your "bug reports" seem to rarely be bugs. Please get other users to confirm your "bugs" in Ask for Help before posting here.
Source: [A hidden trouble]Wrong A_PriorHotkey in #if order
User avatar
RobertL
Posts: 546
Joined: 18 Jan 2014, 01:14
Location: China

Re: [done!]variable environment release too early when ExitA

22 Sep 2014, 03:05

lexikos wrote:can't refer to two variables with the same name in the same function.
I know the reason now - variable scope.
When static a:=.., then variable a is already a static, not supper global variable.

In tradition thinking, the first a should be static variable, and the second a should be supper global variable.

In fact, a had already been initialized to class object, and a.as is valid too, if put it class a before class c. See the code below.

Code: Select all

#Warn	;no warn shows
o:=new c
ExitApp	;Show 'A,A' as expect.
class a{
	static as:="A"
}
class c{
	__Delete(){
		static _a:=a,sa:=a.as	;Correct
		;~ static a:=a		;Can't 
		MsgBox % _a.as "," sa	;Show 'A,A' as expect when 'ExitApp'. So "This variable has not been assigned a value."?
	}
}
Need I report this bug? for I was afraid to ask too more that look like I always finds fault.
Made corrections to it. [Close]variable scope and initial assignment - brief summary
lexikos wrote:Your "bug reports" seem to rarely be bugs.
Haha, as expected... :cry:
我为人人,人人为己?

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 61 guests