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-Thread: 103376,1f8689f27f0e2d9a X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news2.volia.net!newsfeed01.sul.t-online.de!newsfeed00.sul.t-online.de!t-online.de!irazu.switch.ch!news-zh.switch.ch!switch.ch!cernne03.cern.ch!cern.ch!news From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Correct use of variants Date: Tue, 08 Nov 2005 09:40:22 +0100 Organization: CERN - European Laboratory for Particle Physics Message-ID: References: NNTP-Posting-Host: abpc10883.cern.ch Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sunnews.cern.ch 1131439222 12408 (None) 137.138.37.241 X-Complaints-To: news@sunnews.cern.ch User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050922 Red Hat/1.7.12-1.1.3.2.SL3 X-Accept-Language: en-us, en In-Reply-To: Xref: g2news1.google.com comp.lang.ada:6277 Date: 2005-11-08T09:40:22+01:00 List-Id: Stephen Leake wrote: >>but I might have difficulty deciding which value is better than the >>others for this role. > > It makes absolutely no difference. The syntax makes it look like you > are giving a default value to the discriminant, but it doesn't matter > what value you put; it will never be used. Yes, it will be used: type Discriminated(Which : Chooser := First) is -- ... A : Discriminated; -- later: Put(A.X); -- OK, because the First part is in use, -- even though X is not initialized (you get garbage) Put(A.Y); -- CONSTRAINT_ERROR at run-time > I usually use: > > type Foo_Type (descrim : Descrim_Type := Descrim_Type'first) is ...; > > to indicate that I don't care what the default descriminant is. Indeed, looks to be self-documenting. Thank you for this and other responses. -- Maciej Sobczak : http://www.msobczak.com/ Programming : http://www.msobczak.com/prog/