Hi,
I'm currently interested in type inference. RoelTyper works by:
- searching all messages that are sent to instance variables - searching all affections to instance variables
I think this is the kind of things that can be done on file based languages (dynamically typed).
But we are working with a live system with classes and their instances. It may be interesting to look at the instances of a given class and then get the type of the instance variable you want. If there are multiple instances of the class, we have to merge the results.
Is it a good idea ?
On Fri, 30 Jun 2006 15:05:04 +0200, "Damien Cassou" damien.cassou@laposte.net said:
... But we are working with a live system with classes and their instances. It may be interesting to look at the instances of a given class and then get the type of the instance variable you want. If there are multiple instances of the class, we have to merge the results.
Is it a good idea ?
Yes, it's easier to implement, at least. Vassili Bykov wrote exactly such an instance-based inferencer (or "type collector") for Squeak, and I included it in my Whisker browser so that it shows the types for instance variables in the browser when it can. See the Whisker Browser on SqueakMap, or at http://www.mindspring.com/~dway/smalltalk/whisker.html . (Better to use with 3.8 at the moment... I need to put out the 3.9-compatible version soon.)
See the "Whisker-VB-Type Collector" category for the implementation of the type collector.
- Doug
I'm currently interested in type inference. RoelTyper works by:
- searching all messages that are sent to instance variables
- searching all affections to instance variables
I think this is the kind of things that can be done on file based languages (dynamically typed).
It is not the only way to infer types with dynamically typed languages. For instance, let's assume you have:
a := A new. self foo: a.
Then you can infer than foo: takes a type A as argument.
I know that Lex Spoon worked on a type inference system.
But we are working with a live system with classes and their instances. It may be interesting to look at the instances of a given class and then get the type of the instance variable you want. If there are multiple instances of the class, we have to merge the results.
Is it a good idea ?
Maybe be interesting to couple this with testing...
Cheers, Alexandre
Info on my type inference work is here:
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
I completely agree.
But note that the name is Wuyts, not Wutz :-)
On 04 Jul 2006, at 16:45, Lex Spoon wrote:
Info on my type inference work is here:
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
Thanks Lex!
Alexandre
Am Jul 4, 2006 um 3:45 PM schrieb Lex Spoon:
Info on my type inference work is here:
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
squeak-dev@lists.squeakfoundation.org