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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ca15935e4fb21334 X-Google-Attributes: gid103376,public From: Matthew Heaney Subject: Re: Storage space question Date: 1998/12/12 Message-ID: #1/1 X-Deja-AN: 421610989 Sender: matt@mheaney.ni.net References: <366FE278.FAF73497@pwfl.com> <74pfg4$3s6$1@nnrp1.dejanews.com> <36704ADB.73FA308D@pwfl.com> <3671463B.33E291@pwfl.com> <74tr9g$ei4$1@tsunami.traveller.com> NNTP-Posting-Date: Sat, 12 Dec 1998 12:55:38 PDT Newsgroups: comp.lang.ada Date: 1998-12-12T00:00:00+00:00 List-Id: "David C. Hoos, Sr." 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 : ; Read (fd, X); case X is when Run | Stop | Turn => when others => end case; Like representation clauses for enumeration types, the Valid attribute just adds unnecessary complexity to the language.