Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83 (MC840302); site boring.UUCP
Path: utzoo!watmath!clyde!cbosgd!ihnp4!mhuxn!mhuxr!ulysses!allegra!mit-eddie!think!harvard!seismo!mcvax!boring!guido
From: guido@boring.UUCP
Newsgroups: net.lang
Subject: Re: Type-System Questions
Message-ID: <6665@boring.UUCP>
Date: Sun, 27-Oct-85 09:39:11 EST
Article-I.D.: boring.6665
Posted: Sun Oct 27 09:39:11 1985
Date-Received: Wed, 30-Oct-85 04:26:16 EST
References: <15100005@ada-uts.UUCP>
Reply-To: guido@mcvax.UUCP (Guido van Rossum)
Organization: "Stamp Out BASIC" Committee, CWI, Amsterdam
Lines: 49
Apparently-To: rnews@mcvax.LOCAL

In article <15100005@ada-uts.UUCP> richw@ada-uts.UUCP writes:
>Does anyone know of any languages that either:
>1) Attempts to do compile-time type-checking via "type inference"?
>   That is, by analyzing the data flow of a program, the compiler
>   tells you when it's sure that a type mismatch occurs -- this allows
>   the programmer to not explicitly declare types.

"B" does exactly this.  E.g., after looking at
	PUT t[a+1] IN b		\ this is B syntax for   b := t[a+1]
the system knows that 't' is a table (array) whose keys are numbers, that
'a' is a number, and that 'b' has the same type as the elements of 't'.
See reference [1].

>   Yes, I know that this can lead to situations where a variable may refer
>   to objects of several types, and is thus not perfect.

What you see here as a defect can actually be a useful extension to
a language: "generic" procedures are now for free!  This, too is provided
by B.  See also reference [2].

>2) Includes BOTH compile-time types and run-time, "manifest" types?
>   By compile-time type, I mean that the type of an object is only
>   known by the compiler during compilation -- at run-time, there
>   are no flags (or the like) attached to data marking its type.
>   Manifest types refer to objects which do have such flags indicating
>   type.

We are planning an extension to B to allow this, without disturbing
the existent type system.  (We don't have publishable material on this,
yet.)

References:

[1] L.G.L.T. Meertens, Draft Proposal for the B Programming Language.
    Mathematisch Centrum, Amsterdam, 1981.  ISBN 90 6169 238 2.

[2] R. Milner, A theory of type polymorphism in programming, Journal
    of Computer and System Sciences, vol 17 (1978), 348-375.

Disclaimer:

We are well aware of the fact that there is another language called "B",
in use at Waterloo University for system programming on old hardware.
Please don't post followups saying this again!
In the near future, "our" B will be renamed to ABC and at the same time
revised at many minor points.

-- 
	Guido van Rossum, CWI, Amsterdam (guido@mcvax.UUCP)