Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/17/84; site opus.UUCP
Path: utzoo!linus!philabs!cmcl2!seismo!hao!nbires!opus!rcd
From: rcd@opus.UUCP (Dick Dunn)
Newsgroups: net.lang
Subject: Re: Type-System Questions
Message-ID: <175@opus.UUCP>
Date: Tue, 29-Oct-85 23:55:06 EST
Article-I.D.: opus.175
Posted: Tue Oct 29 23:55:06 1985
Date-Received: Thu, 31-Oct-85 09:13:55 EST
References: <15100005@ada-uts.UUCP>
Organization: NBI,Inc, Boulder CO
Lines: 39

> Does anyone know of any languages that either:
> ...(item deleted)
> or...
> 
> 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...

Terminology problem here:  "Manifest" types are types known to the
compiler.  Types known only at runtime are called "latent" types.
Roughly the same meanings are associated with "static types" (known to the
compiler) and "dynamic types" (known at runtime; more to the point,
changeable at runtime).

There are various examples of languages which have both manifest and latent
types.  In the common examples, latent types occur only in a few well-
defined situations--in order to allow the compiler to make as much use of
manifest type information as possible.

Pascal's variant record is a weak example; the active variant of the
record is determined by a "flag", namely the tagfield just ahead of the
variant portion of the record.  I say it's a weak example because the
burden is on the programmer to examine the tagfield and act accordingly.

A better example is the ALGOL 68 union.  Access to a particular element
("variant" as it were) of the union is achieved by means such as a
case-conformity clause, which is a case statement whose selection is based
on the (hidden) type indicator of a union.  (Yes, I know I should be saying
things like "object" and "united from types..."  Forgive me, ALGOL 68
aficionados; I'm trying to use common terms.)  In a case-conformity, you
can't get to a section of code that assumes an inappropriate type.  Another
method of access is the "conforms-to-and-becomes", an assignment operator
that guards against inappropriate type.
-- 
Dick Dunn	{hao,ucbvax,allegra}!nbires!rcd		(303)444-5710 x3086
   ...At last it's the real thing...or close enough to pretend.