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,6742ab01b9814abe,start X-Google-Attributes: gid103376,public From: "James A. Squire" Subject: type casting tagged types in the wrong direction Date: 1996/03/27 Message-ID: <3159B860.28A6@csehp3.mdc.com>#1/1 X-Deja-AN: 144559746 sender: Ada programming language comments: cc: ja_squire@csehp3.mdc.com content-type: text/plain; charset=us-ascii organization: MDA Avionics Tools & Processes mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 2.0 (X11; I; HP-UX A.09.01 9000/715) Date: 1996-03-27T00:00:00+00:00 List-Id: I have a question: Say I have something like: type A is tagged record X : ABC; Y : DEF; end record; type B is new A with record W : GHI; end record; type C is new B with record Z : JKL; end record; OK. Now, let's say that I forgot which type extends off of which, and I write a statement like this: Jim : C; Jane : B; Save : JKL; begin ... Jim := C (Jane); Save := Jim.Z; ... end; GNAT 3.03 compiles this statement. Is that really right? Is Jim.Z defined? According to the LRM 4.6, the above is called a "view conversion". This raises the question, how do you take a type C view of a type B entity when type C looks for additional information? Should a validated Ada95 compiler flag this usage? I realize that GNAT is not validated. I would appreciate any expert or otherwise opinions that any of you have to offer. Thank you. -- James Squire MDA Avionics Tools & Processes ja_squire@csehp3.mdc.com "one of these days I'm going to better myself by going to Knight school"