comp.lang.ada
 help / color / mirror / Atom feed
* Re: [Q] Forward declaration
  1996-03-18  0:00 [Q] Forward declaration Vegard Bakke
@ 1996-03-18  0:00 ` Stephen M. Garriga
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen M. Garriga @ 1996-03-18  0:00 UTC (permalink / raw)


Vegard Bakke <vegard3@kihdata.kih.no> wrote:

>>I have a package spesification A, that needs to know about
>>package spesification B, that needs to know about a package
>>spesification A, that ...
The general opinion is that when you have two package spec's refering
to each other, you have too many or too few packages.
Either 1) combine the packages or 2) separate out the declarations
witch both require into a 3rd package spec.

>>Are there any forward declaration in ADA? How does it work?
Yes - package specs & standard forward declaration (see following hack
example0

package X is

  procedure a(p1 :in integer);

  procedure b;

  -- a & b are visible to all procedures in X
end X;

package body X is

  procedure c(fred :in out character);
  -- c is now visible to procedures following

  procedure d is
  begin
    c;
  end d;
  -- d is visible to procedures following

  procedure b is
  begin
    a;
  end b;

  procedure c(fred : in out character) is
  begin
    text_io.put_line("Yeuch!");
    d;
  end c;

  procedure a(p1 : in integer) is
  begin
    b;
  end a;
end X;  

>>Vegard
>>-- 
>>_________________________________________________________________________
>>|      snailto: Vegard Bakke, Kirkegata 9, 3600 Kongsberg, Norway
>>|
>>| mailto:vegard3@kihdata.kih.no   http://knoll.kih.no:8001/stud/vegard3
>>|
>>|		              no.test er best                           

PS the example is designed to ILLUSTRATE and NOT to be functional

Steve Garriga                         garrigas@logica.com                 
   type OPINION is access PERSONAL_THOUGHTS_AND_BIAS; 
   OPINION_STATED : new OPINION := not LOGICA.OPINION;
Logica UK Ltd.   +44 171 637 9111   http://www.logica.com





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Q] Forward declaration
@ 1996-03-18  0:00 Vegard Bakke
  1996-03-18  0:00 ` Stephen M. Garriga
  0 siblings, 1 reply; 2+ messages in thread
From: Vegard Bakke @ 1996-03-18  0:00 UTC (permalink / raw)


I have a package spesification A, that needs to know about
package spesification B, that needs to know about a package
spesification A, that ...

Are there any forward declaration in ADA? How does it work?

Vegard
-- 
_________________________________________________________________________
|      snailto: Vegard Bakke, Kirkegata 9, 3600 Kongsberg, Norway
|
| mailto:vegard3@kihdata.kih.no   http://knoll.kih.no:8001/stud/vegard3
|
|		              no.test er best                           |




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1996-03-18  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-03-18  0:00 [Q] Forward declaration Vegard Bakke
1996-03-18  0:00 ` Stephen M. Garriga

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