comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: decomposing large packages
Date: Thu, 09 Jan 2020 17:43:40 +0000
Date: 2020-01-09T17:43:40+00:00	[thread overview]
Message-ID: <ly1rs81q5v.fsf@pushface.org> (raw)
In-Reply-To: 3ab1342f-a6d5-42ce-8bb0-1b49d3fd5e42@googlegroups.com

mario.blunk.gplus@gmail.com writes:

>> P's body can see P.S1:
>> 
>>    package P.S1 is
>>       procedure N (Value : Thing) is null; -- save typing :-)
>>    end P.S1;
>> 
>>    with P.S1;
>>    package body P is
>>       procedure M (Value : Thing) is
>>       begin
>>          S1.N (Value);
>>       end M;
>>    end P;
>
> Thanks Simon, but the body of P can't see the specification of S1.

Oh yes it can. Full test program:

package P is
   type Thing is new Integer;
   procedure M (Value : Thing);
end P;
with P.S1;
package body P is
   procedure M (Value : Thing) is
   begin
      S1.N (Value);
   end M;
end P;
with Ada.Text_IO;
package P.S1 is
   procedure N (Value : Thing);
end P.S1;
package body P.S1 is
   procedure N (Value : Thing) is
   begin
      Ada.Text_IO.Put_Line ("P.S1.N called with " & Value'Img);
   end N;
end P.S1;
with P;
procedure Test is
begin
   P.M (42);
end Test;

===============

$ gnatmake test -f
gcc -c test.adb
gcc -c p.adb
gcc -c p-s1.adb
gnatbind -x test.ali
gnatlink test.ali
gnatlink: warning: executable name "test" may conflict with shell command
$ ./test
P.S1.N called with  42

  reply	other threads:[~2020-01-09 17:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-08 15:56 decomposing large packages mario.blunk.gplus
2020-01-08 16:36 ` Dmitry A. Kazakov
2020-01-09  8:25   ` mario.blunk.gplus
2020-01-09  8:58     ` Dmitry A. Kazakov
2020-01-09 18:24       ` G. B.
2020-01-10 20:03         ` mario.blunk.gplus
2020-01-08 16:45 ` Simon Wright
2020-01-09  8:28   ` mario.blunk.gplus
2020-01-09 17:43     ` Simon Wright [this message]
2020-01-10 20:00       ` mario.blunk.gplus
2020-01-08 21:41 ` Shark8
replies disabled

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