comp.lang.ada
 help / color / mirror / Atom feed
From: wf@dcs.gla.ac.uk (Bill Findlay)
Subject: Re: One type for all
Date: 1999/07/20
Date: 1999-07-20T00:00:00+00:00	[thread overview]
Message-ID: <wf-2007991859050001@wyre.dcs.gla.ac.uk> (raw)
In-Reply-To: 7mttci$edv$1@nnrp1.deja.com

In article <7mttci$edv$1@nnrp1.deja.com>, Robert Dewar <robert_dewar@my-deja.com> wrote:

> In article <yeciu7hg0oo.fsf@king.cts.com>,
>   Keith Thompson <kst@cts.com> wrote:
> > ] Two types are said to be _compatible_ if any of the
> > following four conditions is true.
> > ]
> > ]     (a) They are the same type.
> > ]     (b) One is a subrange of the other, or both are subranges of the
> > ]         same host type.
> > ]     (c) Both are set types, their base types are compatible, and either
> > ]         both are packed or neither is packed.
> > ]     (d) Both are string types with the same number of components.
> 
...
> So thanks, it is indeed the case that Pascal does NOT have
> structural type equivalence, which is what I remembered (any
> other conclusion would have been a big surprise!)
> 

This is fairly off-topic in comp.lang.ada, but just for the record:
while it is true that Pascal does NOT have structural type equivalence,
type equivalence and type compatibility are NOT the same relationship.

There are three type relationships in Pascal:

(a) equivalence: the types denoted by identifiers T1 and T2 are equivalent
    iff T1 and T2 are the SAME identifier or the two are explicitly equated,
    thus: "type T2 = T1";
    an anonymous type is equivalent to no other type
    
(b) compatibility: as defined above; this is the relationship required
    between (e.g.) the type of a record's variant selector (~discriminant)
    and that of a case constant (~literal choice)

(c) assignment compatibility: the relationship between the types of the
    two sides of an assignment (among other things); defined in terms
    of compatibility (among other things).

Equivalence is required (e.g.) between the types of actual & formal VAR params;
assignment compatibility between the types of actual & formal VALUE params. 

All of this was set out in British Standard BS 6192, first promulgated in 1979,
and the parent of the ANS and ISO Pascal Standards.

There have been essentially no definitional ambiguities in Pascal
for the best part of 20 years. Plenty of time for everyone to catch up,
one might think, but Pascal never recovered from an onslaught of ignorant
deprecation very reminiscent of that directed a little later against Ada.
Compiler writers who selectively ignored the Standard only added to the problem.

Ada has held out against its detractors much better; in large part, I think,
because its progenitors learned from the Pascal experience and ensured that
a definitive standard was there from the start.

-- 
Bill Findlay
Department of Computing Science
The University of Glasgow




  parent reply	other threads:[~1999-07-20  0:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3783E0D2.5D74243@boeing.com>
1999-07-08  0:00 ` One type for all czgrr
1999-07-09  0:00 ` Samuel T. Harris
1999-07-10  0:00   ` Ehud Lamm
1999-07-12  0:00     ` Samuel T. Harris
1999-07-12  0:00   ` Robert Dewar
1999-07-12  0:00     ` Larry Kilgallen
1999-07-17  0:00       ` Robert Dewar
1999-07-18  0:00         ` Samuel T. Harris
1999-07-18  0:00         ` Keith Thompson
1999-07-19  0:00           ` Robert Dewar
1999-07-18  0:00             ` Keith Thompson
1999-07-19  0:00             ` Robert A Duff
1999-07-20  0:00               ` Robert Dewar
1999-07-19  0:00             ` Tucker Taft
1999-07-20  0:00             ` Bill Findlay [this message]
1999-07-12  0:00     ` Samuel T. Harris
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox