Page 1 of 1

OwnProps conflicts ObjOwnPropCount - how do you enumerate over all methods?

Posted: 02 Aug 2021, 18:24
by guest3456
i dont expect anyone to really answer other than lexikos, since no one has any idea how objects in v2 work, but who knows maybe a miracle happens and someone can figure it out

Code: Select all

#Requires AutoHotkey v2.0-beta

msgbox("prop count=" ObjOwnPropCount(cls))
for k,v in cls.OwnProps()
   msgbox("index=" A_Index "`nk=" k)

msgbox("prop count=" ObjOwnPropCount(cls.prototype))
for k,v in cls.prototype.OwnProps()
   msgbox("index=" A_Index "`nk=" k)

instance := cls()
msgbox("prop count=" ObjOwnPropCount(instance.base))
for k,v in instance.base.OwnProps()
   msgbox("index=" A_Index "`nk=" k)

class cls
{
   one()
   {
   }

   two()
   {
   }

   three()
   {
   }
}


Re: OwnProps conflicts ObjOwnPropCount - how do you enumerate over all methods?

Posted: 02 Aug 2021, 18:45
by kczx3
since no one has any idea how objects in v2 work
Really? Do you honestly think that?

Re: OwnProps conflicts ObjOwnPropCount - how do you enumerate over all methods?

Posted: 02 Aug 2021, 18:48
by guest3456
kczx3 wrote:
02 Aug 2021, 18:45
Really? Do you honestly think that?
yes, the object logic has changed so many times that you can probably count the number of people who understand it on one hand. regardless

can you answer the question in the topic? or make sense of the example code?

Re: OwnProps conflicts ObjOwnPropCount - how do you enumerate over all methods?

Posted: 02 Aug 2021, 18:50
by kczx3
Not at a computer at the moment to run the code and provide feedback

Re: OwnProps conflicts ObjOwnPropCount - how do you enumerate over all methods?

Posted: 02 Aug 2021, 18:53
by guest3456
kczx3 wrote:
02 Aug 2021, 18:50
Not at a computer at the moment to run the code and provide feedback
prop counts are 2,4,4 respectively in order, yet each for loop only iterates 1 time, with keys: "prototype", "__class", "__class"

Re: OwnProps conflicts ObjOwnPropCount - how do you enumerate over all methods?  Topic is solved

Posted: 02 Aug 2021, 19:12
by guest3456
ok i figured it out, apparently the for loop requires one variable instead of two

Code: Select all

for k in prototype.ownprops
;not
for k,v in prototype.ownprops

Re: OwnProps conflicts ObjOwnPropCount - how do you enumerate over all methods?

Posted: 02 Aug 2021, 19:30
by kczx3