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,b0d68c502c0ae6 X-Google-Attributes: gid103376,public From: Robert A Duff Subject: Re: Printing Enum Variable Re: Linux World Date: 1999/03/05 Message-ID: #1/1 X-Deja-AN: 451601054 Sender: bobduff@world.std.com (Robert A Duff) References: <7bfc2n$jl9@dfw-ixnews5.ix.netcom.com> <7bhh26$r7c$1@remarQ.com> <36DCAC1F.430E2C5E@aasaa.ofe.org> <7bk4v8$kl8$1@remarQ.com> <36DDA761.7B4E8099@aasaa.ofe.org> <7bkrmm$ao1$1@nnrp1.dejanews.com> <36DE0007.5236CEA2@aasaa.ofe.org> <7bmmu2$n0h@news1.newsguy.com> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 1999-03-05T00:00:00+00:00 List-Id: Samuel Mize writes: > To say that a language provides the "enum" concept as a type, that > language must ensure that a variable of that type will hold only those > values, and it must provide the standard operations (like 'Last and > 'First) for an enumeration. If it doesn't do this for you, it doesn't > support the type as an entity of the language. Pascal does not provide anything like 'First and 'Last. But I would still say that Pascal supports enumeration types. > Or not, if you used a "when others" alternative to provide a default > behavior. This is less safe than explicitly listing all alternatives, > but it can be a convenience, and it's safe if you're sure that the > possible alternatives won't change (for instance, a case based on type > type character). You use this -- if you're savvy -- knowing that you > have lost part of the protection that a case statement usually provides. You don't have to be sure the set of alternatives won't change. You just have to be sure that "others" will still be correct when they *do* change. In other words, think of "when others =>" as meaning "all other values, including the ones that somebody might add to the program in the future", rather than, "all other values that exist in this program today". Also, type Character *does* change. It changed from Ada 83 to Ada 95, for example. This broke some code I was porting to Ada 95, and I was thankful that all of the problems were detected at compile time, primarily because of the full-coverage rules for case statements. Another case would be where you take some existing code that works with Character, and change it to use Wide_Character. - Bob -- Change robert to bob to get my real email address. Sorry.