I think GeekDude is implying (in response to tic's statement that b := new A() ; where 'A' is an instance still works) that the fact that an object deriving from another object can become a prototype itself should be attributed to prototype-based OOP - which I think is correct since that is how prototyping works. If so, it has nothing to do with syntax in this context since a := {}, b := new a, c := new b, d := new c kind of sums up prototype-based OOP and is a generally normal syntax of stating that a new object is being created and that it is deriving from another object. Unless you're talking about the choice to store class objects in a normal variable as the "confusing" part... Well a class declaration in AHK is simply: var myClass = { "myMethod": function() { . . . } } in Javascript.guest3456 wrote:actually, you can thank AHK syntax choices for confusing you about this.
If MyClass contains the only reference to an object, then there's no way to retrieve it. If one removes the "__Class" key you can see it being released via __Delete defined in a base object:guest3456 wrote:but if a user somehow does MyClass := "" will this class be released and no mechanism to start it back up?
Code: Select all
A := "" ; release
return
class A extends B {
static ClassName := ObjDelete(A, "__Class") ; remove '__Class' key to allow trigger of __Delete
}
class B {
__Delete() {
MsgBox RELEASED
}
}