[a132] nested classes initialization issue Topic is solved

Report problems with documented functionality
User avatar
aseiot
Posts: 79
Joined: 05 Mar 2017, 04:25

[a132] nested classes initialization issue

Post by aseiot » 20 Apr 2021, 06:45

I have encounter a problem with latest a132. Following demonstrate the issue. The all 3 scripts locate in same folder.

I know the a132 change the Class Initialization logic. So could some one help me to figure out how to handle it.

In this situation, I can just comment out the line "#include d.ahk" to make this work, but the real world is I have more extend classes like this. :?

a.ahk

Code: Select all

class a extends d
{
	class b extends d.e
	{
	}
}



#include d.ahk					; this line should be commented out otherwise will report "c.ahk (3) : ==> Unknown class."
#include c.ahk
c.ahk

Code: Select all

class c extends d
{
	class e extends d.e
	{
	}
}

#include d.ahk
d.ahk

Code: Select all

class d
{
	class e
	{
	}
}

lexikos
Posts: 9494
Joined: 30 Sep 2013, 04:07
Contact:

Re: [a132] nested classes initialization issue

Post by lexikos » 20 Apr 2021, 20:21

This is not an initialization issue. Initialization is only for static variables and static __new, and it happens at runtime. This gives a load-time error.

This is a bug with extending classes before they are defined. I've moved the topic to Bug Reports.

lexikos
Posts: 9494
Joined: 30 Sep 2013, 04:07
Contact:

Re: [a132] nested classes initialization issue

Post by lexikos » 21 Apr 2021, 04:13

Correction: this is a bug with extending nested classes after they are defined.

The problem is that resolution of the class still depends on the nested class being an "own value property" of the class, but now it's implemented via a getter to support class initialization and d.e().

lexikos
Posts: 9494
Joined: 30 Sep 2013, 04:07
Contact:

Re: [a132] nested classes initialization issue  Topic is solved

Post by lexikos » 26 Apr 2021, 23:51

Fixed by v2.0-a133.

Post Reply

Return to “Bug Reports”