From mboxrd@z Thu Jan 1 00:00:00 1970
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
ip-172-31-65-14.ec2.internal
X-Spam-Level:
X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,FREEMAIL_FROM,
T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Blady
Newsgroups: comp.lang.ada
Subject: Equivalence between named access and anonymous access.
Date: Wed, 6 Sep 2023 16:37:08 +0200
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: Wed, 6 Sep 2023 14:37:09 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="670427d81b15799f52a4c075a72b6b70";
logging-data="2676169"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/JPKQJi3Ov+KZVdrsLxqSw"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.13.0
Cancel-Lock: sha1:RS8KjLfSbLeoU111w2VOnht8zGc=
Content-Language: en-US
Xref: news.eternal-september.org comp.lang.ada:65603
List-Id:
Hello,
I'm wondering about named access and anonymous access.
In the following Ada code, are the writing of parameter P1 type of
procedures PA and PB equivalent ?
package C1 is
type Inst is tagged null record;
type Class is access all Inst'Class;
end C1;
with C1;
package C2 is
type Inst is tagged null record;
type Class is access all Inst'Class;
procedure PA (Self : Inst; P1 : C1.Class); -- named access
procedure PB (Self : Inst; P1 : access C1.Inst'Class); -- anonymous
access
end C2;
Same with:
function FA (Self : Inst) return C1.Class; -- named access
function FB (Self : Inst) return access C1.Inst'Class; -- anonymous
access
Are FA and FB writing equivalent?
If not why?
Thanks, Pascal.