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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Protected Type compiler complaint Date: Mon, 07 Jul 2014 18:21:06 +0100 Organization: A noiseless patient Spider Message-ID: References: <35cd9c91-4b2c-4baa-9ef6-3c69fd7086ce@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx05.eternal-september.org; posting-host="5cbec41b82bafb9ba55107f02585e18b"; logging-data="14092"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Qfev1rd5dzrZVIFbNrDhJxVWyExo/fWY=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) Cancel-Lock: sha1:LqK+62vCtgM9EataWy/eDUPbSU4= sha1:Zx7wxc/oM+WJipjzLxsD29EbbAE= Xref: news.eternal-september.org comp.lang.ada:20781 Date: 2014-07-07T18:21:06+01:00 List-Id: NiGHTS writes: > I would like to make available to other spawned tasks these protected > variables, so essentially Test.P needs to be a global of some kind > with static data in the currently running process. I heard much about > not creating global variables for good Ada coding practice, so how is > this protected package variables expected to be usable by these > spawned tasks? As Adam says, an instance of Test.P. with Test; package Globals is O : Test.P; end Globals; will make the instance globally visible, and any of your packages can then call Globals.O.DoSomething, obtaining protected access to the private variables of O. Whether it's good coding practice to do this is a different question; but at least you'll have safe access to O's content.