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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!ames!ucbcad!ucbvax!SKL-CRC.ARPA!bradford From: bradford@SKL-CRC.ARPA.UUCP Newsgroups: comp.lang.ada Subject: A Problem With Access Types Message-ID: <8704081652.AA09954@skl-crc.ARPA> Date: Wed, 8-Apr-87 11:52:36 EST Article-I.D.: skl-crc.8704081652.AA09954 Posted: Wed Apr 8 11:52:36 1987 Date-Received: Sat, 11-Apr-87 10:41:55 EST Sender: daemon@ucbvax.BERKELEY.EDU Distribution: world Organization: The ARPA Internet List-Id: I am writing a program which manipulates a large, complex data structure. The data structure consists of many embedded records and arrays of records. I wish to have a procedure update a particular record within this structure, and what I tried to do originally was to simply create an access type variable for the record type and then have this access variable refer to the record and then pass the access variable to the procedure. The following segment represents what I tried to do: type A_REC is record ... end; type A_ACCESS is access A_REC; A : A_REC; A_A : A_ACCESS; begin ... A_A := A; -- Also tried A_A := A_ACCESS(A); UPDATE(A_A); ... end; Ada (VAX Ada 1.3) won't let me do this, and after re-reading the LRM, it seems that this is consistent with the LRM. So I have to do it some other way. Some options are: 1) Pass the whole structure and require the called procedure to know the structure (I really don't like this option). 2) Copy the appropriate record, pass the copy as an inout parameter, and update the record from the returned copy. 3) Give up and quit (but that means I won't get paid and I really like getting paid). Option 2 is workable for the problem I described above, but having access types would be easier for a similar, related problem (which I won't go into here). Can anyone supply another altrernative, or perhaps a way of using access types like I wanted to originally. I would be most grateful. Bob Bradford