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,4ee5611d3fbf05b7 X-Google-Attributes: gid103376,public From: blaak@infomatch.com (Ray Blaak) Subject: Re: Enumeration literal visibility and use type Date: 1998/05/26 Message-ID: <6kf612$iuj$1@berlin.infomatch.com>#1/1 X-Deja-AN: 356736702 References: <6kej65$dnh$1@hermes.seas.smu.edu> <6kejt5$75u@gcsin3.geccs.gecm.com> <6kelnr$ief$1@polo.advicom.net> X-Complaints-To: usenet@berlin.infomatch.com X-Trace: berlin.infomatch.com 896211810 19411 (None) 199.60.99.1 Organization: InfoMatch Internet - Vancouver BC Newsgroups: comp.lang.ada Date: 1998-05-26T00:00:00+00:00 List-Id: "David C. Hoos, Sr." writes: >John is correct. The only way I've found to make the literals visible >(without a context clause "use doodah;") is in the units requiring >visibility is to declare: >state_0 : constant doodah.state_value_type := doodah.state_0; >Anyone have a better way? I like doing: package doodah is package State is type Value is (state0, state1, ...); end State; ... end doodah; with doodah; procedure Main is use doodah.State; cool : doodah.State.Value := state0; begin end Main; Another approach, especially when you only need the literals in a case statement, is to do: package doodah is type state_value is (state0, ...); ... end doodah; with doodah; procedure Report_State(The_State : in doodah.state_value) is type states is new doodah.state_value; -- literals are now in scope begin case states(The_State) is when state0 => ...; when state1 => ...; ... end case; end Report_State; Cheers, The Rhythm is around me, The Rhythm has control. Ray Blaak The Rhythm is inside me, blaak@infomatch.com The Rhythm has my soul.