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,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a72073231ca787ee X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!z15g2000prn.googlegroups.com!not-for-mail From: deadlyhead Newsgroups: comp.lang.ada Subject: Re: Determining value of record discriminant Date: Mon, 19 Jul 2010 17:33:49 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <3cc302a1-2764-438c-ba28-361c513fa8df@x20g2000pro.googlegroups.com> NNTP-Posting-Host: 216.57.220.9 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1279586029 8678 127.0.0.1 (20 Jul 2010 00:33:49 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 20 Jul 2010 00:33:49 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: z15g2000prn.googlegroups.com; posting-host=216.57.220.9; posting-account=snJuNwoAAABnc8T9lYkBlDQrDdSjOjG2 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6 (.NET CLR 3.5.30729),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:12476 Date: 2010-07-19T17:33:49-07:00 List-Id: On Jul 19, 5:26=A0pm, "Jeffrey R. Carter" wrote: > On 07/19/2010 03:36 PM, deadlyhead wrote: > > > > > > > -- =A0code begins > > type Discrim_Val is (Int, Str); > > > type Discrim_Rec (D : Discrim_Val) is record > > =A0 =A0 case D is > > =A0 =A0 =A0 =A0when Int =3D> > > =A0 =A0 =A0 =A0 =A0 Val_Int : Integer :=3D 1_000_000; > > =A0 =A0 =A0 =A0when Str =3D> > > =A0 =A0 =A0 =A0 =A0 Val_Str : String (1 .. 11) :=3D "One million"; > > =A0 =A0 end case; > > end record; > > -- =A0code ends > > > Is there any way to determine what the discriminant value was on a > > type later on, i.e. with a dynamically allocated Discrim_Rec object > > created with user input for D? =A0A haven't found anything looking > > through the RM about attributes or anything providing this > > functionality. > > V : Discrim_Rec :=3D Some_Func; > > case V.D is > when Int =3D> > =A0 =A0 ... > when Str =3D> > =A0 =A0 ... > end case; > > The discriminant is a field just like any other. > > -- > Jeff Carter > "How'd you like to hide the egg and gurgitate > a few saucers of mocha java?" > Never Give a Sucker an Even Break > 101 Thank you! I really don't know how I missed that.