From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Access idiom
Date: Mon, 21 Jan 2008 22:11:04 -0600
Date: 2008-01-21T22:11:04-06:00 [thread overview]
Message-ID: <fn3qf1$91p$1@jacob-sparre.dk> (raw)
In-Reply-To: adad44a1-0519-4333-add6-86936adc7ab1@l1g2000hsa.googlegroups.com
"Gene" <gene.ressler@gmail.com> 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.
next prev parent reply other threads:[~2008-01-22 4:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-20 19:57 Access idiom Gene
2008-01-21 1:01 ` Ludovic Brenta
2008-01-21 4:16 ` Gene
2008-01-21 15:37 ` Robert A Duff
2008-01-22 4:11 ` Randy Brukardt
2008-01-22 4:11 ` Randy Brukardt [this message]
2008-01-21 9:05 ` Dmitry A. Kazakov
2008-01-21 18:15 ` Jeffrey R. Carter
2008-01-22 3:56 ` Gene
2008-01-22 5:10 ` Gene
2008-01-22 9:01 ` Dmitry A. Kazakov
2008-01-22 18:47 ` Jeffrey R. Carter
2008-01-22 4:15 ` Randy Brukardt
2008-01-22 4:15 ` Randy Brukardt
-- strict thread matches above, loose matches on Subject: below --
2008-01-21 7:12 Grein, Christoph (Fa. ESG)
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox