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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,83b83c553c3b79cf X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-14 08:53:43 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newspeer.radix.net!uunet!ash.uu.net!xyzzy!nntp From: Jeffrey Carter Subject: Re: Problem with Enumaration and visibility X-Nntp-Posting-Host: e246420.msc.az.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: <3BF29CBA.46D5F9B2@boeing.com> Sender: nntp@news.boeing.com (Boeing NNTP News Access) Content-Transfer-Encoding: 7bit Organization: The Boeing Company X-Accept-Language: en References: Mime-Version: 1.0 Date: Wed, 14 Nov 2001 16:32:58 GMT X-Mailer: Mozilla 4.73 [en]C-CCK-MCD Boeing Kit (WinNT; U) Xref: archiver1.google.com comp.lang.ada:16518 Date: 2001-11-14T16:32:58+00:00 List-Id: Preben Randhol wrote: > > package Setup is > -- ... > > type Method_Enum_Type is (Spell, MChoice); > > procedure Get_Method return Method_Enum_Type; > -- ... > end Setup; > > with Setup; > > package body Examine is > > -- ... > > procedure Start is > Method : Setup.Method_Enum_Type := Setup.Get_Method; > begin > if Method = Setup.Method_Enum_Type'(Spell) then > Examine.Spelling.Start; > end if; > end Start; This has nothing specifically to do with enumeration types. Anything declared in a package specification is not directly visible outside the package. In the fragment of Setup shown, you declare a type, 2 enumeration literals (which are actually functions), a function (I presume, though you call it a procedure). The type declaration implicitly declares a number of operations, including "=", "/=", "<", ">", and so on. None of these things are directly visible outside the package without a use clause. In Examine, you reference the type (Method_Enum_Type), an operation ("="), and an enumeration literal (Spell). Without a use clause, none of these are directly visible; they must all be prefixed with "Setup.". You did this for the type, but not for the operation or literal. You have a number of choices: 1. Prefix everything: if Setup."=" (Method, Setup.Spell) then 2. Add "use Setup;". This eliminates the need to prefix anything. 3. Add "use type Setup.Method_Enum_Type;". This eliminates the need to prefix "=", but you will still need to prefix Spell. 4. Rename the operations of interest: function "=" (Left, Right : Setup.Method_Enum_Type) return Boolean renames Setup."="; function Spell return Setup.Method_Enum_Type renames Setup.Spell; if Method = Spell then 5. Some combination of the above. This situation arises for anything declared in one package but referenced elsewhere. -- Jeffrey Carter