TypeInference: File based way of thinking

Lex Spoon lex at cc.gatech.edu
Tue Jul 4 14:45:39 UTC 2006


Info on my type inference work is here:

  http://www.lexspoon.org/ti


This includes documentation and a demo image that you can download and
play with.  You can also install my inferencer from SqueakSource, but
I have not tested it with anything newer than Squeak 3.7.

The main selling point of my inferencer is that it has a serious
attempt at being sound.  I worked out a formal semantics of Smalltalk,
and my analyzer generates correct results (upper bounds on the types)
so long as you stay within the assumptions of the system.

Garau's inferencer includes an unrealistic assumption that you do not
have aliases, i.e. that you never have two different variables
pointing to the same object.  Wutz's SOUL-based inferencer is very
fast but is based entirely on heuristics.

I'd guess you would want to use Wutz's inferencer for browsers in
contexts where you do not *really* need the result to be correct, and
mine in curcumstances where an error in the inferencer is more costly.


To return to the initial query, Damien is discussing the initial state
of the heap.  By default my inferencer assumes an initially empty
heap--or equivalently, that the code you ask about does not use things
in the initial heap.  Often this is enough.  For other cases, you
would have to have the system consider the initial heap in some
fashion.  This is possible with my inferencer--look through the
methods of class Inferencer--but I have not worked with it much and so
it is immature.


Finally, there are limits to how far any analyzer can go.  For
example, no system can allow the programmer to add and remove
arbitrary methods and classes as the program runs.  All (sound) static
analyzers make some assumptions about the program and then find out
what is possible given those assumptions.


-Lex





More information about the Squeak-dev mailing list