From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9d0b383ee17c13af X-Google-Attributes: gid103376,public From: "Samuel T. Harris" Subject: Re: One type for all Date: 1999/07/12 Message-ID: <378A6F37.DDF7FF99@hso.link.com>#1/1 X-Deja-AN: 500285939 Content-Transfer-Encoding: 7bit References: <3783E0D2.5D74243@boeing.com> <3786741C.E73F1124@hso.link.com> <7mdobd$fu$1@nnrp1.deja.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Raytheon Training Inc. Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-07-12T00:00:00+00:00 List-Id: Robert Dewar wrote: > > In article <3786741C.E73F1124@hso.link.com>, > "Samuel T. Harris" wrote: > > > Types in both Ada 83 and Ada 95 use name-equivalence instead > > of structural-equivalence (as is found in Pascal). > > Am I really misremembering Pascal that badly. Surely Pascal > has name equivalence, e.g. if you declare two identical > record types with different names, they are different types. > I think you are confusing name/structural equivalence with the > different rules in Pascal about compatibility of types. > > But perhaps I am remembering wrong ... > > I'm on vacation so my Pascal texts are out of reach :-) > > Sent via Deja.com http://www.deja.com/ > Share what you know. Learn what you don't. I refer to the way type structures can be built directly in an variable declaration. The only Ada 83 equivalent is the anonymous array type used in an object declaration and which has special rules which specifies each as a separate type. In Ada, a pointer to an array of records involves at least three type declarations and then an object declaration using the last access type. In Pascal, the object can be declared directly when all the type structure in one "line" of code. What does it mean in Pascal when two objects are declared using the same type structures? Unfortunately, the original Pascal rules did not deal with this situation. Some implementations choose to create internal type names for each such usage. Others did not. This resulting in some implementations enforcing named-equivalence and some allowing the more looser structural-equivalence. Two records with different names _are_ different types. Two objects with the same record structure in their declaration is not so clear. As I recall my college days, the greatest occurance of this "feature" was declaring objects as pointers to things instead of declaring a pointer type and using that. If three objects are declared as pointers to the same type, are the three objects of the same type? Depends on the implementation. -- Samuel T. Harris, Principal Engineer Raytheon, Scientific and Technical Systems "If you can make it, We can fake it!"