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!news2.google.com!newsread.com!news-xfer.newsread.com!nntp.abs.net!news.abs.net!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Correct use of variants References: From: Stephen Leake Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (windows-nt) Cancel-Lock: sha1:rlbHLCOYRtNKW0Iv13NNIICw31k= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 07 Nov 2005 18:40:54 -0500 NNTP-Posting-Host: 66.159.65.1 X-Complaints-To: abuse@toad.net X-Trace: news.abs.net 1131406855 66.159.65.1 (Mon, 07 Nov 2005 18:40:55 EST) NNTP-Posting-Date: Mon, 07 Nov 2005 18:40:55 EST Xref: g2news1.google.com comp.lang.ada:6273 Date: 2005-11-07T18:40:54-05:00 List-Id: Maciej Sobczak writes: > What is the correct way to achieve the declaration of A with the > possibility of changing the discriminant later? One of the ways is to > use *some* default value for the discriminant, That is the only way. > 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. > An arbitrary choice would create a misleading message to the reader > that the particular value is considered to be "best" or "idle" or > "starting" or whatever. 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. > In addition, having a default value for the discriminant means that > it's not obligatory to initialize the variable A while it's declared > and I would like to keep this enforced. Other posts have addressed this. -- -- Stephe