Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

The first version always gets thrown away.


devel / comp.lang.ada / Re: Limited with too restrictive?

SubjectAuthor
* Limited with too restrictive?Blady
`- Re: Limited with too restrictive?Randy Brukardt

1
Limited with too restrictive?

<unucno$89u$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10384&group=comp.lang.ada#10384

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: p.p11@orange.fr (Blady)
Newsgroups: comp.lang.ada
Subject: Limited with too restrictive?
Date: Sat, 13 Jan 2024 17:11:35 +0100
Organization: A noiseless patient Spider
Lines: 52
Message-ID: <unucno$89u$1@dont-email.me>
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
 by: Blady - Sat, 13 Jan 2024 16:11 UTC

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.

Re: Limited with too restrictive?

<unvo1e$ak5u$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10385&group=comp.lang.ada#10385

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: randy@rrsoftware.com (Randy Brukardt)
Newsgroups: comp.lang.ada
Subject: Re: Limited with too restrictive?
Date: Sat, 13 Jan 2024 22:31:12 -0600
Organization: A noiseless patient Spider
Lines: 70
Message-ID: <unvo1e$ak5u$1@dont-email.me>
References: <unucno$89u$1@dont-email.me>
Injection-Date: Sun, 14 Jan 2024 04:30:39 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b4104de19fa1ce2211373a2c928c3d16";
logging-data="348350"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+m74T9ajLP+ZAGlSo1X5uSyb+9MhPabdA="
Cancel-Lock: sha1:pLY6Lo2/6MwBOV/e4PTzJBdk8IU=
X-MSMail-Priority: Normal
X-Priority: 3
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246
 by: Randy Brukardt - Sun, 14 Jan 2024 04:31 UTC

"Blady" <p.p11@orange.fr> wrote in message
news:unucno$89u$1@dont-email.me...
> 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

For a limited with, one only knows the syntactic declarations (we cannot
assume any analysis). Therefore, we cannot know the representation of any
type, including access types.

Specifically, compilers may support multiple representations for access
types, for a variety of reasons (the underlying machine has different
representations, as on the 8086 and U2200 that we did compilers for; because
additional data needs to be carried along to implement Ada semantics - GNAT
did that for access to unconstrained arrays, and so on). The representation
can depend upon aspect specifications, the designated subtype, and more,
none of which is known at the point of a limited with.

We couldn't restrict implementations to a single representation for access
types, and thus limited with has to treat them the same as other types.

It's necessary to declare local access types for entities that are accessed
from a limited view. The reason that anonymous access types were expanded
was to make that less clunky -- but I don't think it succeeded.

....
> Well, I could make some code transferts from unit to another or access
> conversions, that's I actually do but at heavy cost.

Yup, but the alternative is worse - requiring all access types to be the
most general representation (which can have a heavy performance cost).

Randy.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor