comp.lang.ada
 help / color / mirror / Atom feed
From: "J-P. Rosen" <rosen@adalog.fr>
Subject: Re: Discriminants of tagged types
Date: Wed, 27 Oct 2010 19:58:50 +0200
Date: 2010-10-27T19:58:50+02:00	[thread overview]
Message-ID: <ia9p8t$5ue$1@news.eternal-september.org> (raw)
In-Reply-To: <op.vk8ry4ijule2fv@garhos>

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



  parent reply	other threads:[~2010-10-27 17:58 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-27 12:16 Discriminants of tagged types Maciej Sobczak
2010-10-27 12:34 ` Ludovic Brenta
2010-10-27 13:19   ` Dmitry A. Kazakov
2010-10-27 13:52     ` Robert A Duff
2010-10-27 14:12       ` Dmitry A. Kazakov
2010-10-27 13:44 ` Robert A Duff
2010-10-27 15:06   ` Adam Beneschan
2010-10-27 15:58     ` Yannick Duchêne (Hibou57)
2010-10-27 16:35       ` Vinzent Hoefler
2010-10-27 17:58       ` J-P. Rosen [this message]
2010-10-27 20:18         ` Yannick Duchêne (Hibou57)
2010-10-27 20:26       ` Adam Beneschan
2010-10-27 22:07         ` Yannick Duchêne (Hibou57)
2010-10-27 22:42           ` Adam Beneschan
2010-10-27 15:13   ` Maciej Sobczak
2010-10-27 16:02     ` Yannick Duchêne (Hibou57)
2010-10-27 21:13       ` Maciej Sobczak
2010-10-27 21:23         ` Ludovic Brenta
2010-10-28  8:38           ` Maciej Sobczak
2010-10-27 21:25         ` Vinzent Hoefler
2010-10-28  7:53         ` Dmitry A. Kazakov
2010-10-28  8:50           ` Maciej Sobczak
2010-10-28 10:28             ` Dmitry A. Kazakov
2010-10-28 17:48             ` Yannick Duchêne (Hibou57)
2010-10-29 18:59             ` Vinzent Hoefler
2010-10-30 21:05               ` Maciej Sobczak
2010-10-30 21:21                 ` Vinzent Hoefler
2010-10-30 22:01                   ` Yannick Duchêne (Hibou57)
2010-10-31 16:20                   ` Maciej Sobczak
2010-10-31 17:04                     ` Yannick Duchêne (Hibou57)
2010-10-31 18:36                     ` Shark8
2010-10-31 21:06                       ` Maciej Sobczak
2010-11-01  0:44                         ` Shark8
2010-11-01  9:41                           ` Maciej Sobczak
2010-10-27 16:06     ` Robert A Duff
2010-10-27 16:34       ` Yannick Duchêne (Hibou57)
2010-10-27 21:05       ` Maciej Sobczak
2010-10-28  0:35         ` Robert A Duff
2010-10-28  8:55           ` Maciej Sobczak
2010-10-27 21:28       ` Simon Wright
2010-10-27 13:54 ` J-P. Rosen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox