What is Expressiveness in a Computer Language

Anton van Straaten anton at appsolutions.com
Sat Jun 24 19:19:16 CEST 2006


David Hopwood wrote:
> Anton van Straaten wrote:
...
>>When you get to more complex cases, though, most type inferencers for
>>Scheme assign traditional static-style types to terms.  If you think
>>about this in conjunction with the term "latent types", it's an obvious
>>connection to make that what the inferencer is doing is recovering types
>>that are latent in the source.
> 
> 
> But these types are not part of the Scheme language. If you combine Scheme
> with a type inferencer, you get a new language that is not R*RS Scheme,
> and *that* language is typed.

Sure.  So one obvious question, as I've just observed in another reply 
to you, is which language programmers actually program in.  I'd say that 
they certainly don't program in the completely untyped language as 
defined by RnRS.

> Note that different inferencers will give different type assignments.
> They may be similar, but they may also be quite dissimilar in some cases.
> This casts considerable doubt on the assertion that the inferencer is
> "recovering types latent in the source".

I mentioned this earlier, in a reply to Marshall where I gave an 
informal definition of latent typing, which read in part: "Terms in the 
program may be considered as having static types, and it is possible to 
infer those types, but it isn't necessarily easy to do so automatically, 
and there are usually many possible static type schemes that can be 
assigned to a given program."

As far as the term "recovering" goes, that perhaps shouldn't be taken 
too literally.  It's clearly not the case that a latently-typed program 
has a single formalizable type scheme which was put there deliberately 
by the programmer.  But programmers do reason about things like the 
types of functions and expressions, and the goal of soft type 
inferencers is to find an approximation to what the programmer intended.

Anton



More information about the Python-list mailing list