What is Expressiveness in a Computer Language
Anton van Straaten
anton at appsolutions.com
Fri Jun 23 02:54:13 CEST 2006
Andreas Rossberg wrote:
> Rob Warnock wrote:
>> Here's what the Scheme Standard has to say:
>> 1.1 Semantics
>> Scheme has latent as opposed to manifest types. Types are assoc-
>> iated with values (also called objects) rather than with variables.
>> (Some authors refer to languages with latent types as weakly typed
>> or dynamically typed languages.) Other languages with latent types
>> are APL, Snobol, and other dialects of Lisp. Languages with manifest
>> types (sometimes referred to as strongly typed or statically typed
>> languages) include Algol 60, Pascal, and C.
> Maybe this is the original source of the myth that static typing is all
> about assigning types to variables...
> With all my respect to the Scheme people, I'm afraid this paragraph is
> pretty off, no matter where you stand. Besides the issue just mentioned
> it equates "manifest" with static types. I understand "manifest" to mean
> "explicit in code", which of course is nonsense - static typing does not
> require explicit types. Also, I never heard "weakly typed" used in the
> way they suggest - in my book, C is a weakly typed language (= typed,
> but grossly unsound).
That text goes back at least 20 years, to R3RS in 1986, and possibly
earlier, so part of what it represents is simply changing use of
terminology, combined with an attempt to put Scheme in context relative
to multiple languages and terminology usages. The fact that we're still
discussing this now, and haven't settled on terminology acceptable to
all sides, illustrates the problem.
The Scheme report doesn't actually say anything about how latent types
relate to static types, in the way that I've recently characterized the
relationship here. However, I thought this was a good place to explain
how I got to where I am on this subject.
There's been a lot of work done on soft type inference in Scheme, and
other kinds of type analysis. The Scheme report talks about latent
types as meaning "types are associated with values". While this might
cause some teeth-grinding amongst type theorists, it's meaningful enough
when you look at simple cases: cases where the type of a term is an
exact match for the type tags of the values that flow through that term.
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.
Once that connection is made, it's obvious that the tags associated with
values are not the whole story: that the conformance of one or more
values to a "latent type" may be checked by a series of tag checks, in
different parts of a program (i.e. before, during and after the
expression in question is evaluated). I gave a more detailed
description of how latent types relate to tags in an earlier reply to
Marshall (Spight, not Joe).
More information about the Python-list