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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a05:620a:15ec:: with SMTP id p12mr41281096qkm.247.1579303852981; Fri, 17 Jan 2020 15:30:52 -0800 (PST) X-Received: by 2002:aca:889:: with SMTP id 131mr5142579oii.3.1579303852697; Fri, 17 Jan 2020 15:30:52 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!g89no7663457qtd.0!news-out.google.com!w29ni1575qtc.0!nntp.google.com!g89no7663453qtd.0!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 17 Jan 2020 15:30:52 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=2601:645:c000:3db6:11f2:3c91:8e9:96fb; posting-account=GiLbEwoAAACYQywnkrMcpkBZWnZYVPiI NNTP-Posting-Host: 2601:645:c000:3db6:11f2:3c91:8e9:96fb User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Calling a record type's methods (functions or procedure) when record is in an array From: Mace Ayres Injection-Date: Fri, 17 Jan 2020 23:30:52 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader01.eternal-september.org comp.lang.ada:57865 Date: 2020-01-17T15:30:52-08:00 List-Id: My package 'trunks.ads' includes ... type a_trunk;. function set_lock ... return lock_state; function post_val(v:integer) --- return integer ... type a_trunk is record id : ,,, val ... lock : lock_state -- enumeration type defined earlier (open, locked) end record; Package body 'trunks.adb includes ... function set_lock ( ..... not relevant function post_val i(v:integer) return integer is ..return v; ------ In package 1 I have a multi dimension array of type a_truck that I get to with .. loop de loop i,j my_trunk_array (i)(j) .. ------- To modify the item val in the trunk at array (5)(3) I code.. ... my_truck_arrary(5)(3).val := trunks.post_val(N) rather than my_tunk_arrary(5)(3).val := N so I don't directly access the a_trunk record's value fields directly -- I have to add the private part too, to hide the inners of type a_trunk. It seem a little convoluted, but I see no other way to manipulate my a_truck type records that only 'exist' the array. I am just learning Ada. Is this reasonable?