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.9 required=5.0 tests=BAYES_00,REPLYTO_WITHOUT_TO_CC, UNRESOLVED_TEMPLATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2e8cf506f89b5d0a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-06-20 20:06:08 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!howland.erols.net!news-out.nntp.airnews.net.MISMATCH!cabal10.airnews.net!news.airnews.net!cabal2.airnews.net!news-f.iadfw.net!usenet From: gresset1@airmail.net Newsgroups: comp.lang.ada Subject: Re: Looping over a tagged record? Date: Wed, 20 Jun 2001 22:09:41 -0500 Organization: Airnews.net! at Internet America Message-ID: <64607A9576042FBD.660EF84A579DEA8D.6D310E1A8628B45C@lp.airnews.net> X-Orig-Message-ID: <9uo2jtoios05d43i0cdcb7iq17lc25tc1h@4ax.com> References: <9god9a$g04$0@208.164.98.151> Reply-To: gresset1@airmail.net Abuse-Reports-To: abuse at airmail.net to report improper postings NNTP-Proxy-Relay: library2.airnews.net NNTP-Posting-Time: Wed Jun 20 22:02:57 2001 NNTP-Posting-Host: !_U*N1k-W%MUL*c (Encoded at Airnews!) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:8958 Date: 2001-06-20T22:09:41-05:00 List-Id: "M R Goodwin" wrote: >Hi! > >This is a part practical, and a part 'I wonder' type problem. >I have a tagged record that is pretty big. Most, but not all of >the elements in it are a bounded string type. Because I don't feel >like the typing and all I would need to do to assign and later change >values, I was wondering if there is anyway to loop over all elements in >the record, checking their type and then taking the right action... > >type Big_record is tagged record >a1 : String_60; >a2 : String_60; >n1 : Integer; >... >a30 : String_60; >end record; > >And I want to do something like: >(And yes, I know its not Ada code!) >For I in ?number of elements? loop > if I is Integer then Blah, blah > elsif I is String_60 Blah, Blah. >end; > > >I've been messing around with it, and have not come to any workable >solution. > >Thanks for the help, > >Matthew This looks to me like a case of trying to use a screwdriver for a saw. In broad concept, you are trying to use an iterator to pass through the contents of a container and should use something that is a better fit to that model than a tagged record.