Re: Enumerated data types

kurt@tc.fluke.COM (Kurt Guntheroth)
Wed, 29 Aug 90 16:02:56 GMT

          From comp.compilers

Related articles
[5 earlier articles]
Re: Enumerated data types jejones@microware.com (1990-08-27)
Re: Enumerated data types perelgut@turing.toronto.edu (1990-08-24)
Re: Enumerated data types dik@cwi.nl (1990-08-27)
Re: Enumerated data types grover@brahmand.Eng.Sun.COM (1990-08-28)
Re: Enumerated data types corbett@lupa.Eng.Sun.COM (1990-08-29)
Re: Enumerated data types pjj@cs.man.ac.uk (Pete Jinks) (1990-08-29)
Re: Enumerated data types kurt@tc.fluke.COM (1990-08-29)
Re: Enumerated data types anw@maths.nott.ac.uk (1990-08-29)
| List of all articles for this month |

Newsgroups: comp.compilers
From: kurt@tc.fluke.COM (Kurt Guntheroth)
Keywords: C, Ada, design
Organization: John Fluke Mfg. Co., Inc., Everett, WA
References: <1990Aug23.134826.2865@forwiss.uni-passau.de>
Date: Wed, 29 Aug 90 16:02:56 GMT

Ada allows enumerated types whose member names are overloaded. You resolve
the ambiguity by specifying the type in ambiguous situations. The syntax
is <type_specifier>'(<expression>) in Ada (though I'm sure Ada uses
different names for the metasymbols).


        car_colors is (red, blue, brown, black);
        bike_colors is (orange, red, green, white);
. . .


        x := car_colors'(red);


There was a certain amount of discussion of how this ought to be done in
SIGPLAN Notices in 1981 or so, but I havn't bothered to go look them up. As
I remember, the papers were mostly picking on Ada because it was very stylish
to pick on Ada back then. Now it is stylish simply to ignore Ada.
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.