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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,989d0c2f2f87320d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-01-10 03:58:05 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!news.iac.net!news-out.cwix.com!newsfeed.cwix.com!news.maxwell.syr.edu!unlisys!news.snafu.de!news1.dtag.de!news.dvz-mv.de!ngen.mteege.de!nobody From: Matthias Teege Newsgroups: comp.lang.ada Subject: Re: Record type with check? Date: 10 Jan 2001 08:47:05 +0100 Organization: DVZ Datenverarbeitungszentrum Mecklenburg-Vorpommern GmbH Sender: matthias@moon.mteege.de Message-ID: <87hf373l3a.fsf@moon.mteege.de> References: <868zolm9dp.fsf@book.mteege.de> NNTP-Posting-Host: ppps-nb03.mvnet.de Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 User-Agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/20.5 Xref: supernews.google.com comp.lang.ada:3857 Date: 2001-01-10T08:47:05+01:00 List-Id: Stephen Leake writes: > Matthias Teege writes: > > > Moin, > > > > ist there any way to build a record type like this: > > > > type Datum is > > record > > Var_A : Integer; > > Var_B : Integer; > > end record; > > > > which guarantees that Var_B is bigger than Var_A? > > This sounds like a homework problem, so I'll only give hints. If it's > not homework, please reply with more info on why you need this. No it isn't a homework (see http://www.mteege.de/index_en.html) but your assumption describe my knowledge level very well. ;-) Learning Ada is only a hobby. The type should represent ranges from Var_A to Var_B and associate Var_C with this range. Somthing like this: Var_A Var_B Var_C 1 2 10 2 4 12 4 7 13 .. > You cannot simply declare a type that has this property. But you can > write a package that declares an abstract data type that does enforce > this property. It must have a Create procedure that checks that A < B, > and access procedures that let clients access A and B. Ok, thats the answer I'm looking for. If nobody knows a better representation I'll made a private type. ;-) Many thanks Matthias -- Matthias Teege -- matthias@mteege.de -- http://emugs.de make world not war PGP-Key auf Anfrage