From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,887bac6875d2db34 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!news.tiscali.fr!club-internet.fr!feedme-small.clubint.net!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Access idiom Date: Mon, 21 Jan 2008 22:11:04 -0600 Organization: Jacob's private Usenet server Message-ID: References: <87wsq4xa93.fsf@ludovic-brenta.org> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: jacob-sparre.dk 1201033895 8958 69.95.181.76 (22 Jan 2008 20:31:35 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 22 Jan 2008 20:31:35 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1914 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1914 Xref: g2news1.google.com comp.lang.ada:19539 Date: 2008-01-21T22:11:04-06:00 List-Id: "Gene" wrote in message news:adad44a1-0519-4333-add6-86936adc7ab1@l1g2000hsa.googlegroups.com... ... >In concept, what I'd need to do is something like this: >type Node_Ptr_Type is access Node_Type'Class; >procedure Op(P : in Threat_Type; Result : out Node_Ptr_Type) is >begin > Result := P'Access; -- identity operation >end Op; This is how Claw works, so it obviously is OK. You do need to use "'Unchecked_Access" instead of "'Access", and you need to declare the type "access all".] >... or the other way: > >procedure Op(P : access Threat_Type; Result : out Node_Ptr_Type) is >begin > Result := Node_Ptr_Type(P); -- identity operation >end Op; This works, but I think it is nasty to the client, because they have to convert objects into access values at the call interface. Since "P : in Threat_Type" is passed by reference, but doesn't carry runtime accessibility, it's actually cheaper than "P : access Threat_Type". Randy.