[a133] Built-in sub-classes can't be extended (ie. Gui.Text) Topic is solved

Report problems with documented functionality
User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

[a133] Built-in sub-classes can't be extended (ie. Gui.Text)

Post by TheArkive » 25 Apr 2021, 08:11

Built-in classes can be extended (like Gui), but the sub classes don't seem to exist in a133.

The code won't continue after the first error. But each one of the "error" marked ones still throw an error when the others are commented out.

Code: Select all

class test4 extends Gui { ; <---- no error

}

class test extends Gui.ListBox { ; <---- error

}

class test2 extends Gui.Custom { ; <---- error

}

class test3 extends Gui.Text { ; <---- error

}

Code: Select all

 ---------------------------
 __test_v2.ahk
 ---------------------------
 Error at line 1.

 Line Text: Gui.custom
 Error: Unknown class.

 The program will exit.
 ---------------------------
 OK   
 ---------------------------

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

Re: [a133] Built-in sub-classes can't be extended (ie. Gui.Text)

Post by lexikos » 25 Apr 2021, 21:14

It looks like I forgot to update the Gui classes to match the new behaviour of nested classes. Load-time class resolution relies on the nested classes being defined a specific way.
Changed classes to static-initialize on first access, or when the class definition is reached during execution. They were previously initialized before any other global code is executed, strictly in the order of definition. See Class Initialization for details.

Changed calls to nested classes to omit the outer class from the parameter list. For instance, a new class with no __New can be instantiated with a.nested.class() as in v2.0-a127 and earlier, instead of requiring (a.nested.class)() or a.nested.class.call().

To support the above changes, changed nested classes to create a property getter and method instead of storing the class directly as a value property.
Source: AutoHotkey v2 alpha (UPDATES) - Page 5 - AutoHotkey Community

User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: [a133] Built-in sub-classes can't be extended (ie. Gui.Text)

Post by TheArkive » 26 Apr 2021, 08:55

No problemo!

I'm just glad the intent is to still extend the built-in classes/sub-classes :D

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

Re: [a133] Built-in sub-classes can't be extended (ie. Gui.Text)  Topic is solved

Post by lexikos » 22 May 2021, 21:29

Fixed by v2.0-a134 and v2.0-a135.

Post Reply

Return to “Bug Reports”