From: Matthew Heaney <matthew_heaney@acm.org>
Subject: Re: Storage space question
Date: 1998/12/12
Date: 1998-12-12T00:00:00+00:00 [thread overview]
Message-ID: <m3iufhm64f.fsf@mheaney.ni.net> (raw)
In-Reply-To: 74tr9g$ei4$1@tsunami.traveller.com
"David C. Hoos, Sr." <david.c.hoos.sr@ada95.com> writes:
> Matthew Heaney wrote in message ...
> >"As long as you only use the constants (not the literals), you get all
> >the type safety that an enumeration type buys you."
> >
> >The object will never get assigned the values 3 .. 7, because those
> >values aren't named by constants.
> >
> >If you stick to the constants, then there is no loss of type safety.
> >
> Well, what if the data structure was filled by, say, a read from a network.
> Use of the enumeration allows you to apply the 'valid test.
Yes, but you can validate input data by using a case statement, just
like we did in Ada83:
X : <unconstrained integer subtype>;
Read (fd, X);
case X is
when Run | Stop | Turn =>
<data OK>
when others =>
<handle bad data somehow>
end case;
Like representation clauses for enumeration types, the Valid attribute
just adds unnecessary complexity to the language.
next prev parent reply other threads:[~1998-12-12 0:00 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-12-10 0:00 Storage space question Craig Allen
1998-12-10 0:00 ` dennison
1998-12-10 0:00 ` Marin David Condic
1998-12-10 0:00 ` Pat Rogers
1998-12-10 0:00 ` dennison
1998-12-10 0:00 ` Pat Rogers
1998-12-10 0:00 ` Tucker Taft
1998-12-10 0:00 ` callen
1998-12-10 0:00 ` dennison
1998-12-10 0:00 ` Marin David Condic
1998-12-10 0:00 ` Tucker Taft
1998-12-11 0:00 ` dennison
1998-12-11 0:00 ` Matthew Heaney
1998-12-11 0:00 ` Marin David Condic
1998-12-12 0:00 ` Matthew Heaney
1998-12-12 0:00 ` David C. Hoos, Sr.
1998-12-12 0:00 ` Matthew Heaney [this message]
1998-12-14 0:00 ` dennison
1998-12-11 0:00 ` Matthew Heaney
1998-12-10 0:00 ` Matthew Heaney
1998-12-10 0:00 ` dennison
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox