TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender:
"Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
X-To:
Date:
Sun, 3 Dec 2000 11:11:25 -0500
Reply-To:
Michael Feldman <[log in to unmask]>
Subject:
From:
Michael Feldman <[log in to unmask]>
Content-Transfer-Encoding:
7bit
In-Reply-To:
<[log in to unmask]> from "Stephane Richard" at Dec 03, 2000 04:55:44 PM
Content-Type:
text/plain; charset=us-ascii
MIME-Version:
1.0
Parts/Attachments:
text/plain (56 lines)
Hi -

[asked Stephane]
>
> Hello everyone,
>
> I have a quick questions that I couldn't directly find the answer to
> quickly.
>
> Let's say I have 5 different packages performign distinct tasks.  How
> would I go about declaring an array that I could make global to all these
> packages say either from another package that would use these 5 existing one,
> and/or from a main program.  if I have an array of 100 elements, and I want to
> make that array available to these packages, does the fact that I declare
> this variable in the calling package render this array available to any package
> being called by the calling package or program?

If I understand your question, you simply want to declare a variable
(in this case, an array) that is globally visible to your other packages
and to main.

(Instinctively I'd usually ask "why would you want to do this?" But
let's leave aside any design questions about the possible debugging
nightmares in having so many different units reading and writing this
global data, and just treat it as a language issue.)

The standard Ada approach to this is simply to create a package that
contains your global data. Often this is just a package spec with no body;
that seems to be the case here. Let's call this package (what else?)
Globals. Then your main, and your other packages, just 'with Globals;'.
>
> If not, is there a way to do this?

This is the way, if I understand your question correctly.
>
> Thank you all for your help.
>
> Stephane Richard
> Software Developer

Yours truly,

Michael Feldman
------------------------------------------------------------------------
Michael B. Feldman -  chair, ACM SIGAda Education Working Group
Professor, Department of Computer Science
The George Washington University -  Washington, DC 20052 USA
[log in to unmask] - 202-994-5919 (voice) - 202-994-4875 (fax)
http://www.seas.gwu.edu/~mfeldman
------------------------------------------------------------------------
"Teach me to be an engineer. I don't care if it takes all day."
from a Dilbert comic strip
------------------------------------------------------------------------
Visit http://www.acm.org/sigada/education or http://www.adapower.com
------------------------------------------------------------------------

ATOM RSS1 RSS2