Question:
Is there a white paper or something that explains why some variants are converted to strong types and others are set to object? I noticed in the sample application I have been playing with that not all get set to strong types. I could not find a difference between the one that was set to string the one that was set to object.
Answer:
Type Inference is a critical matter in VB6 translation, even more so for ASP/VBScript, and has has been a central theme in the development of our translation platform. We have also implement custom type-inference algorithms in various extensions and gmSL scripts. Type Inference optimization is an important task in our methodology.
In general the tool favors strong typing, but it backs off to object if it means introducing something that would break the build. There are several possible causes of weak typing:
CallByName
function, IF
or Select
based on TypeName
or TypeOf
functionCreateObject)
CreateObject
)Refactor/Fixtype
commands to set the type of specific symbols based on fully-qualified identifierCreateObject
)Registry type="FixType"
to set the type of a class of symbols based on their nametype="dynamic"
. But be warned, that does not really solve type inference issues, it merely simplifies late call syntaxThere are a few more advanced techniques to allow for symbols that are used with multiple-types and even to introduce interfaces or generics where type object or variant was used before.