comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Limited object by reference or access argument?
Date: Mon, 7 Aug 2017 18:28:14 -0500
Date: 2017-08-07T18:28:14-05:00	[thread overview]
Message-ID: <omat2f$sa3$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: om80vg$1a68$1@gioia.aioe.org

I strongly prefer keeping "access" out of interfaces unless absolutely 
necessary. Claw only uses "access" in a couple of circumstances; the vast 
majority of routines use normal object parameter passing.

BTW,  "access" has to pass runtime accessibility information, and it's 
possible to trip over that when converting the parameter to some other type 
(causing Program_Error to be raised). That doesn't happen when using normal 
parameters (although you have to use 'Unchecked_Access if you need an access 
value).

                          Randy.

"Victor Porton" <porton@narod.ru> wrote in message 
news:om80vg$1a68$1@gioia.aioe.org...
> Suppose we have
>
> type World_Type is tagged limited private;
>
> type BNode_ID_Handler is abstract tagged limited private;
>
> We need to set a bnode handler for a world object. Should the procedure
> signature be
>
> procedure Set_Handler (World: World_Type;
>                       Handler: access BNode_ID_Handler'Class);
>
> or
>
> procedure Set_Handler (World: World_Type;
>                       Handler: BNode_ID_Handler'Class);
>
> The later can work with limited BNode_ID_Handler type, because tagged and
> limited types are always passed by reference.
>
> I prefer the second one, because with the first procedure signature it is
> possible to pass an access to an already finalized object what is an 
> error,
> but want to ask you opinion which of the two procedure signatures is 
> better.
>
> -- 
> Victor Porton - http://portonvictor.org 


      parent reply	other threads:[~2017-08-07 23:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-06 21:16 Limited object by reference or access argument? Victor Porton
2017-08-06 22:01 ` Victor Porton
2017-08-06 23:21   ` Victor Porton
2017-08-07  0:35     ` Victor Porton
2017-08-07 23:31     ` Randy Brukardt
2017-08-07 14:10 ` Jere
2017-08-07 23:28 ` Randy Brukardt [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox