comp.lang.ada
 help / color / mirror / Atom feed
From: garrigas@logica.com (Stephen M. Garriga)
Subject: Re: [Q] Forward declaration
Date: 1996/03/18
Date: 1996-03-18T00:00:00+00:00	[thread overview]
Message-ID: <4iju3h$9pg@romeo.logica.co.uk> (raw)
In-Reply-To: 314D63A6.143D@kihdata.kih.no

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





      reply	other threads:[~1996-03-18  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-03-18  0:00 [Q] Forward declaration Vegard Bakke
1996-03-18  0:00 ` Stephen M. Garriga [this message]
replies disabled

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