# [Pharo-project] type inference in Pharo

Frank Shearar frank.shearar at gmail.com
Tue Jul 17 15:58:21 EDT 2012

```On 17 July 2012 18:31, Alexandre Bergel <alexandre.bergel at me.com> wrote:
> Well... I still do not know which algorithm is used. Without a clear answer, I do not know how to compare it with other type inferencer. For example, is the one of Scala more accurate? No idea

Very different kind of beast. Scala's type inference will use some
kind of Hindley-Milner unification based algorithm.

Concrete type inference answers a different question: given some
expression, what are the _actual_ types (hence "concrete", rather than
"the most general possible type"/abstract) of the bits of the
expression.

So running type inference over "1 + e" will say "e is a SmallInteger",
rather than "e is a Number".

I don't think it would be inaccurate to say that it works like
Shivers/etc's k-CFA work.

frank

> Cheers,
> Alexandre
>
>
> On Jul 17, 2012, at 12:08 PM, Guillermo Polito wrote:
>
>> It's in the same blog:
>>
>>
>> Cheers,
>> Guille
>>
>> On Tue, Jul 17, 2012 at 6:03 PM, Alexandre Bergel <alexandre.bergel at me.com> wrote:
>> Hi!
>>
>> There is some work being done on inferring type (http://concretetypeinference.blogspot.com). What is the theoretical background of this work?
>> What is the algorithm used to infer the types?
>>
>> Cheers,
>> Alexandre
>> --
>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>> Alexandre Bergel  http://www.bergel.eu
>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>
>>
>>
>>
>>
>
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>

```