comp.lang.ada
 help / color / mirror / Atom feed
From: rickduley <rickduley@gmail.com>
Cc: rickduley@gmail.com
Subject: Re: Access types as parameters
Date: Fri, 17 Jul 2009 16:25:10 -0700 (PDT)
Date: 2009-07-17T16:25:10-07:00	[thread overview]
Message-ID: <8410fc60-9b8a-4f82-92fc-622a6bbe5931@i18g2000pro.googlegroups.com> (raw)
In-Reply-To: f69aeaa5-5821-45ad-968b-489c7ccce67b@k19g2000yqn.googlegroups.com

On Jul 18, 12:28 am, Hibou57 (Yannick Duchêne)
<yannick_duch...@yahoo.fr> wrote:
> Adam has already given a good answer, but I may say a bit the same in
> shorter words :
>
> access My_Type'Class in a function declaration, is a so called “
> anonymous type ”, and as this type is only declared locally, it cannot
> match any other types defined at wider level (beceause this would
> simply not be type conformant).
>
> access My_Type'Class does not have a so wide validity as
> My_Access_Type may have.
>
> This is conveniant and safe
>
> More words....
>
> As an hint : you may use My_Access_Type if the reference is to be
> stored into a record (as an exemple) and may use access My_Type'Class
> if you only need it locally. Looking at the function signature, you
> may then quicly see what kind of things the function may allowed it-
> self to do with the reference you gave it.
>
> If you see the function wants an “ access My_Type'Class ”, you nearly
> do not have to bother about anything, but if you see it wants a “
> My_Access_Type ” you may need to be sure there is a good collaboration
> between the caller and the callee. This is anyway, a good invitation
> to read the function documentation (if comments are provided about its
> usage).
>
> But this does not means “ access My_Type'Class ” is better beceause it
> is “ safer ” (quotes, beceause the other way is not always not safe),
> as sometime, My_Access_Type is mandatory, depending on what the
> function have to do with the reference.

Hi Yannick

Thanks for that.

I don't quite see what you mean by:

> But this does not means “ access My_Type'Class ” is better beceause it
> is “ safer ” (quotes, beceause the other way is not always not safe),
> as sometime, My_Access_Type is mandatory, depending on what the
> function have to do with the reference.

If the function is called, and the actual parameter is valid, what
difference can it make what the function does with the data?



  reply	other threads:[~2009-07-17 23:25 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-17  8:39 Access types as parameters Rick
2009-07-17 15:03 ` Adam Beneschan
2009-07-17 16:28   ` Hibou57 (Yannick Duchêne)
2009-07-17 23:25     ` rickduley [this message]
2009-07-18  1:03       ` Randy Brukardt
2009-07-19 22:57         ` rickduley
2009-07-20  0:10           ` John B. Matthews
2009-07-20  8:13           ` Dmitry A. Kazakov
2009-07-21  0:34           ` Randy Brukardt
2009-07-21 14:34           ` Adam Beneschan
2009-07-23  2:11             ` Stephen Leake
2009-08-11 23:41               ` Randy Brukardt
2009-08-12  2:22                 ` Stephen Leake
2009-08-13  1:06                   ` Randy Brukardt
2009-08-13  8:34                     ` Niklas Holsti
2009-08-13  9:15                       ` Dmitry A. Kazakov
2009-08-13 20:13                         ` Niklas Holsti
2009-08-13 21:07                           ` Dmitry A. Kazakov
2009-08-14  9:27                             ` Niklas Holsti
2009-08-14 10:36                               ` Dmitry A. Kazakov
2009-08-14 16:03                                 ` Niklas Holsti
2009-08-15  9:47                                   ` Dmitry A. Kazakov
2009-08-15 19:19                                     ` Niklas Holsti
2009-08-16  8:32                                       ` Dmitry A. Kazakov
2009-08-16  9:52                                         ` Niklas Holsti
2009-08-16 12:38                                           ` Dmitry A. Kazakov
2009-08-16 13:21                                             ` Niklas Holsti
2009-08-16 17:58                                               ` Dmitry A. Kazakov
2009-08-14  4:07                       ` Randy Brukardt
2009-08-14 10:22                         ` Niklas Holsti
2009-08-18 12:22                     ` Stephen Leake
replies disabled

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