comp.lang.ada
 help / color / mirror / Atom feed
From: Matthias Teege <matthias@mteege.de>
Subject: Re: Record type with check?
Date: 10 Jan 2001 08:47:05 +0100
Date: 2001-01-10T08:47:05+01:00	[thread overview]
Message-ID: <87hf373l3a.fsf@moon.mteege.de> (raw)
In-Reply-To: ur92cs7da.fsf@gsfc.nasa.gov

Stephen Leake <stephen.a.leake.1@gsfc.nasa.gov> writes:

> Matthias Teege <matthias@mteege.de> writes:
> 
> > Moin,
> > 
> > ist there any way to build a record type like this: 
> > 
> > type Datum is
> >    record
> >       Var_A  : Integer;
> >       Var_B  : Integer;
> >    end record;
> > 
> > which guarantees that Var_B is bigger than Var_A?
> 
> This sounds like a homework problem, so I'll only give hints. If it's
> not homework, please reply with more info on why you need this.

No it isn't a homework (see http://www.mteege.de/index_en.html) 
but your assumption describe my knowledge level very
well. ;-) Learning Ada is only a hobby. 

The type should represent ranges from Var_A to Var_B and
associate Var_C with this range. Somthing like this:

Var_A  Var_B  Var_C
 1      2      10
 2      4      12
 4      7      13
..

> You cannot simply declare a type that has this property. But you can
> write a package that declares an abstract data type that does enforce
> this property. It must have a Create procedure that checks that A < B,
> and access procedures that let clients access A and B.

Ok, thats the answer I'm looking for. If nobody knows a
better representation I'll made a private type. ;-)

Many thanks
Matthias

-- 
Matthias Teege -- matthias@mteege.de -- http://emugs.de
make world not war
PGP-Key auf Anfrage



  reply	other threads:[~2001-01-10  7:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-09  8:12 Record type with check? Matthias Teege
2001-01-09 16:37 ` Florian Weimer
2001-01-09 22:12 ` Stephen Leake
2001-01-10  7:47   ` Matthias Teege [this message]
2001-01-10 17:05     ` Nick Roberts
2001-01-10 21:41     ` Robert Dewar
2001-01-13  0:19       ` mark_lundquist
2001-01-13  1:08         ` Robert Dewar
replies disabled

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