From mboxrd@z Thu Jan 1 00:00:00 1970
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Blady
Newsgroups: comp.lang.ada
Subject: Limited with too restrictive?
Date: Sat, 13 Jan 2024 17:11:35 +0100
Organization: A noiseless patient Spider
Message-ID:
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 13 Jan 2024 16:11:36 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="04107c7bf81b5888ea13b0b6c7c44844";
logging-data="8510"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18CzlYvNQNTmC4myQp2sc9g"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:ER1a5FelY6HooQw4RSVnp9Q5Bl4=
Content-Language: fr, en-US
Xref: news.eternal-september.org comp.lang.ada:65992
List-Id:
Hello,
I want to break some unit circularity definitions with access types as
for instance with record:
type R1;
type AR1 is access R1;
type R1 is record
Data : Natural;
Next : AR1;
end record;
In my case, I have a unit:
package test_20240113_modr is
type R2 is record
Data : Natural;
end record;
type AR2 is access R2;
end test_20240113_modr;
"limited withed" in:
limited with test_20240113_modr;
package test_20240113_mods is
procedure PS1 (V : test_20240113_modr.R2);
procedure PS2 (V : test_20240113_modr.AR2);
end;
Let's imagine the circularity, thus PS1 and PS2 definition are legal.
Of course the following isn't legal:
type AS1 is array (1..2) of test_20240113_modr.R2; -- illegal
However why not with access type:
type AS2 is array (1..2) of test_20240113_modr.AR2; -- illegal
Likewise, why not:
type AS3 is record
Data : Natural;
Next : test_20240113_modr.AR2; -- illegal
end record;
Isn't "limited with" too restrictive, is it?
Well, I could make some code transferts from unit to another or access
conversions, that's I actually do but at heavy cost.
Thanks, Pascal.