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=0.6 required=5.0 tests=BAYES_40,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4ee5611d3fbf05b7 X-Google-Attributes: gid103376,public From: rracine@draper.com (Roger Racine) Subject: Re: Enumeration literal visibility and use type Date: 1998/05/26 Message-ID: #1/1 X-Deja-AN: 356663314 Distribution: na Sender: nntp@news.draper.com (NNTP Master) References: <6kej65$dnh$1@hermes.seas.smu.edu> Organization: Draper Laboratory Newsgroups: comp.lang.ada Date: 1998-05-26T00:00:00+00:00 List-Id: In article <6kej65$dnh$1@hermes.seas.smu.edu> bralick@seas.smu.edu (William Bralick) writes: >By now I have convinced myself that the following does not work as I had >hoped: >-- we are provided the following package and required to use it to >-- interface with other subsystems >package doodah is > type state_value_type is (state0, state1, state2, state_etc); > -- and just to make things interesting, let's create a useful message > type useful_message is record > state_stuff : state_value_type; > other_stuff : natural; > end record; >end doodah; >--- >with doodah; >procedure test is > use type doodah.cool_type; > a_cool_message : useful_message; >begin > a_cool_message.state_stuff := state0; -- SIRENS WAIL, LIGHTS FLASH > -- COMPILER WANTS: > -- doodah.state0 > ... >end test; >--- >For some reason that I have yet to fathom, I had convinced myself >that "use type" would give immediate visibility of the enumerals in >doodah.cool_type. I am now convinced that it doesn't (though I am >ready to argue that it _should_). Section 8.4 of the Ada RM: "a use_type_clause achieves direct visibility of the primitive operators of a type." Enumeration literals are not operators. Roger Racine