[Types-sig] Type inferencing

Greg Stein gstein@lyra.org
Tue, 14 Dec 1999 12:55:31 -0800 (PST)


On Tue, 14 Dec 1999, Guido van Rossum wrote:
> Paul Prescod wrote:
>...
> > cases. I am totally in favor of particular global type inferencing
> > implementations, but am not in favor of requiring global type inference
> > of every static type checker implementation nor of requiring
> > safety-conscious Python users to think in terms of global type
> > inferencing.
> 
> OK, I see and agree.
> 
> I think that I would like to make *some* form of type inference (maybe
> only within the function body) part of the formal specs.  Note that in
> a limited way, inference is already part of Python (and sometimes

I believe that you will always have type inferencing occurring. Maybe I'm
just referring to a degenerate case, but you do need inferencing just to
deal with:

  Int a
  a = foo() + bar()

i.e. inference says "foo-result-type + bar-result-type => Int", so the
     assignment is safe.

> Now, please make some progress with a design...

I've got a partial one for you :-)

* add declarations to "def" statements
* add a type-assertion operator (for discussion, this has been '!')
* use type inference to check func args and returns, and to (pre)check
  type-assertion operators

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/