On Dec 28, 2011, at 6:07 PM, Lukas Renggli wrote:
Indeed, we had to patch it to not crash in Moose. But, still it does not seem to work properly.
Maybe you should rather use RBRefactoryTyper? It is slower, because it needs to parse all the involved source code; but it works correctly and uses a similar (even more powerful) inferencing algorithm.
This is true that roel only checked within a method (from my memory) so with short method this is difficult to get really good result.
RoelTyper and RBRefactoryTyper do essentially the same: For class- and inst-vars they look at all the compiled methods that refer to these variables. RoelType does an abstract byte-code interpretation to figure out the assignments and the messages sent to the variables; RBRefactoryTyper parses the methods and figures out the assignments and messages sent using the AST. Then they both run a very similar algorithm to figure out the most likely kind of object hold in the variables. They do not necessarily report the same classes in the end, because the heuristics are different. Also RBRefactoryTyper goes a step further and tries to figure out type of elements inside collection types.
For method arguments and temporaries they both only look at a single method (there are obviously no other references to the temporaries and arguments). Consequently they both deliver bad results for arguments and temporaries.
Yes when I looked at RB (in 99) I guess that they also used existing instances to try to get more information but mainly for instance variables. I would really like to see more work around practical tools that can help us. I have the work on type inference from francisco garau on my hard-disc. But this is a pity that nobody build on top of that. Stef
Lukas
-- Lukas Renggli www.lukas-renggli.ch