we had this already: variable_exists gives correct result only on first call. If Me was dimensioned once then Variable_Exists results true, no matter if defined in current call or in a call before. So this works as long as the function gets called the MeHack_CallFunction-way only.
Also I can not see any parameters that could be passed to myType.func() in the example - so the approach I took here was more advanced already.
It still requires to insert the same part of code (If something then Dim ..As ... At..) to each and every type-function while the type is "known" anyway to the function since it is its "parent" and also to find as String in the functions name before the dot.
If the call is not made from a variable as usual, ME is not dimensioned inside the function anyway -
There are two ways to call a type-function thinkeable:
-one possibility is to call a special Delegate-Function that would create a local overlay at pData and then call the function on it the regular call-a-type-function through a variable-way, but the problems would be to compose the functions name for the final call from a local variables name and from a string that was passed to delegate. The other problem would be to hand-over the parameters from our actual call to "Delegate" to the finally called Type-function. Both can not be done from tB-scripts currently.
-second possibility would be, to tell type-functions WHERE to find Me -which is probably already the case- and optional TypeOf(Me) if the variables pattern can not be copied from the calling variable. It could as well be taken from the functions name or from the internal stored type-definition where that
Alias STATIC As "type.function Ptr"
is a part of - means a function of a type is in reality just a static variable containing the functions pointer, common to all elements and/or variables of that type
- but all that has to be done very deep inside core...
Bookmarks