Ok so ive just looked at it and I understand why we use generics since when we didnt use generics if we called our base method it would expect the baseclass self not the childs self. However just in the generics part i just got some quick questions if thats ok.
1.Why isnt child_Index used? -- I assume its cause the methods exclusive to the child are stored in the metatable and the inherited methods are stored in the metatables metatable. So in Child_Meta
type child_Index = { dochildstuff:(child_Class)->() }
type child_Meta = typeof( setmetatable({}::{childFunc:(self:child_Class)->();}, {__index=my_Index<child_Data,child_Meta>}))
- I have to turn My_Meta from this:
type my_Meta<T={},C={}> = typeof(setmetatable(C, {__index:my_Index<T,C>}))
to this in order to fix the errors the type checker was giving me (asserted both types to an empty table since setmetatable expects values I assume)
type my_Meta<T={},C={}> = {typeof(setmetatable({} :: C,{} :: {__index:my_Index<T,C>}))}
3.I also had to change child_meta so it wouldnt error with the type checker from this:
type child_Meta = typeof( setmetatable({}::{childFunc:(self:child_Class)->();}, {__index=my_Index<child_Data,child_Meta>}))
to this also to fix the setmetatable issue and changing the = to :
type child_Meta = typeof( setmetatable({}::{childFunc:(self:child_Class)->();}, {} :: {__index: my_Index<child_Data,child_Meta>}))
Did I make any mistakes in these changes or is everything in order? thanks