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: a07f3367d7,4ce5890331a5b529 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,UTF8 Path: g2news1.google.com!news4.google.com!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: "J-P. Rosen" Newsgroups: comp.lang.ada Subject: Re: Discriminants of tagged types Date: Wed, 27 Oct 2010 19:58:50 +0200 Organization: Adalog Message-ID: References: <14314714-e92c-4036-9cbb-da8e72489261@h7g2000yqn.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Wed, 27 Oct 2010 17:58:53 +0000 (UTC) Injection-Info: mx01.eternal-september.org; posting-host="O1RkH+WVNUV47UyqsXe2BA"; logging-data="6094"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/83BKMUyumtsFdcKqF8v9c" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.2.11) Gecko/20101013 Thunderbird/3.1.5 In-Reply-To: Cancel-Lock: sha1:VD+O2p1CEmcWLfvc4VHuYdMkp7Q= Xref: g2news1.google.com comp.lang.ada:14851 Date: 2010-10-27T19:58:50+02:00 List-Id: Le 27/10/2010 17:58, Yannick Duchêne (Hibou57) a écrit : > Indeed, this show very well how can default discriminants be a mess (and > there are other reasons too to add to the ones given here). > > A question then come : do someone know something to which default > discriminants are unavoidable ? I feel default discriminants can simply > be dropped (kind of sugar?), but I would like to be sure. > This issue is very simple and understandable if you take it the other way round. Reminder: I1 : Integer; -- Can take all values of type Integer I2 : Integer range 1..10; -- Constraint, restricts to value 1..10 with: type Rec (D: Disc) is .... I must declare: R1: Rec (1); -- Constraint, restricts to value 1 of discriminant. Wouldn't it be nice to have a variable that could hold all values of type Rec? Naturally, this is written as: R2: Rec; But wait a minute. If the discriminant is not specified by the declaration, what is its value? A discriminant is to serious to leave it uninitialized. OK, therefore this construct is allowed only if the discriminant has default values. QED. -- --------------------------------------------------------- J-P. Rosen (rosen@adalog.fr) Adalog a déménagé / Adalog has moved: 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00