comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Protected Type compiler complaint
Date: Mon, 07 Jul 2014 18:21:06 +0100
Date: 2014-07-07T18:21:06+01:00	[thread overview]
Message-ID: <ly38eddr0d.fsf@pushface.org> (raw)
In-Reply-To: 35cd9c91-4b2c-4baa-9ef6-3c69fd7086ce@googlegroups.com

NiGHTS <nights@unku.us> 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.

  parent reply	other threads:[~2014-07-07 17:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-07  7:15 Protected Type compiler complaint NiGHTS
2014-07-07  7:55 ` Simon Wright
2014-07-07 14:23   ` NiGHTS
2014-07-07 16:37     ` Adam Beneschan
2014-07-07 17:21     ` Simon Wright [this message]
2014-07-08 17:03     ` Shark8
2014-07-08 17:50       ` Anh Vo
2014-07-07 19:06 ` framefritti
2014-07-08  7:11   ` Georg Bauhaus
2014-07-08  7:53   ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox