In statically typed environments Hindley-Milner algorithm may be used to infer the types of expression depending on it's parts. The question is, may this idea be applied to the Smalltalk's pure dynamic environment?
In case of JIT VM we have statistics of which call site affect what classes and potentionally object of what class is returned. Gathering this information we may find a places (call sites and methods) with classes tightly bound to one or more variables. If particular variable appeared to have only one class during the whole runtime, we may then perform an optimization that assumes that current variable always have this class. Thus, specializing the method. Inside, we may treat class as a statically assigned type. This allows us to apply type infering where it is possible.
In statically typed environments Hindley-Milner algorithm may be used to infer the types of expression depending on it's parts. The question is, may this idea be applied to the Smalltalk's pure dynamic environment?
In case of JIT VM we have statistics of which call site affect what classes and potentionally object of what class is returned. Gathering this information we may find a places (call sites and methods) with classes tightly bound to one or more variables. If particular variable appeared to have only one class during the whole runtime, we may then perform an optimization that assumes that current variable always have this class. Thus, specializing the method. Inside, we may treat class as a statically assigned type. This allows us to apply type infering where it is possible.