comp.lang.ada
 help / color / mirror / Atom feed
From: "AG" <ang@xtra.co.nz>
Subject: Re: Ranges and discriminant constraints
Date: Sun, 8 Jun 2003 19:21:23 +1200
Date: 2003-06-08T19:21:23+12:00	[thread overview]
Message-ID: <4tBEa.16019$JA5.308000@news.xtra.co.nz> (raw)
In-Reply-To: jYwEa.2963$7l6.2875@fe03.atl2.webusenet.com

"David C. Hoos" <david.c.hoos.sr@ada95.com> wrote in message
news:jYwEa.2963$7l6.2875@fe03.atl2.webusenet.com...
>
> "Vadim Godunko" <vgodunko@vipmail.ru> wrote in message
> news:665e587a.0306071258.1a8711cc@posting.google.com...
> > Hello,
> >
> > Does anybody explain me why language allow constraint discriminant of
> > discrete type to some value, but not allow constraint to range?
>
> To constrain a discrete type to a more narrow range, you use a subrtype --
> e.g.:
>
> type my_enum is (a, b, c, d, e);
>
> subtype my_constrained_enum is my_enum range b .. d;

I think it's a little bit trickier that that. What the guy
asked for is something like:

X (my_enum)                -- record
Y  my_enum subtype     -- some constraint here
Z                                   -- subtype of X with discriminant Y

Short of generics, any better ideas?





      reply	other threads:[~2003-06-08  7:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-07 20:58 Ranges and discriminant constraints Vadim Godunko
2003-06-07 21:51 ` AG
2003-06-08  6:00   ` Vadim Godunko
2003-06-08  7:45     ` Dmitry A. Kazakov
2003-06-08  2:22 ` David C. Hoos
2003-06-08  7:21   ` AG [this message]
replies disabled

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