Type Compatibility (was:failure due to compiler?)

dlmoore@ix.netcom.com (David L Moore)
15 Jul 1996 11:41:39 -0400

          From comp.compilers

Related articles
failure due to compiler? resler@liberty.mas.vcu.edu (1996-07-03)
Re: failure due to compiler? gclind01@starbase.spd.louisville.edu (1996-07-07)
Re: failure due to compiler? baynes@ukpsshp1.serigate.philips.nl (1996-07-13)
Type Compatibility (was:failure due to compiler?) dlmoore@ix.netcom.com (1996-07-15)
| List of all articles for this month |

From: dlmoore@ix.netcom.com (David L Moore)
Newsgroups: comp.compilers
Date: 15 Jul 1996 11:41:39 -0400
Organization: Netcom
References: 96-07-035 96-07-052 96-07-089
Keywords: Pascal, history

> 'extended' their pascal compiler to permit records with the same structure to
> be type compatible. This caused us several bugs, one of which got so deeply
> embeded in the system before it was found that we were never able to
> completely
> fix it.
This was not an "extension". The original CDC6600 compiler did exactly the same

This was "structure" equivalence rather than "name" equivalence. At the
time, there was a degree of debate about which way type equivalence should
be done. The ideas of data abstraction were not yet worked out, or, at
least, if they were, were not widely known. Remmember, Pascal was designed
in 1968, and that strong typing was a new idea.

Strictly one should also mention "identifier" equivalence to distinguish
it from name equivalence. This is what C and C++ have. These languages
will treat structures with the same identifier as equivalent even though
there is no guarantee that the two structures have the same definition. I
think a good software engineering environment could fix this problem.

"Name" equivalence should mean that there is only one definition, just as
the name of a variable is not its identifier, but rather its address in

In the original ETH Pascal compiler, the following would loop the compiler
in the type equivalence checker:

        A = RECORD
        B = RECORD
                  x:^B; {actually y:^B would fail too, I think}
                aa := bb;

Eventually, you ran out of stack as the compiler recursively tried to
determine if A was structurally equivalent to B.

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.