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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,7ff1de84a8945e80 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,CP1252 Path: g2news2.google.com!postnews.google.com!i18g2000pro.googlegroups.com!not-for-mail From: rickduley Newsgroups: comp.lang.ada Subject: Re: Access types as parameters Date: Fri, 17 Jul 2009 16:25:10 -0700 (PDT) Organization: http://groups.google.com Message-ID: <8410fc60-9b8a-4f82-92fc-622a6bbe5931@i18g2000pro.googlegroups.com> References: <521c4843-d40f-4545-9e80-ca725e847090@h21g2000yqa.googlegroups.com> NNTP-Posting-Host: 123.3.133.108 Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1247873111 13338 127.0.0.1 (17 Jul 2009 23:25:11 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 17 Jul 2009 23:25:11 +0000 (UTC) Cc: rickduley@gmail.com Complaints-To: groups-abuse@google.com Injection-Info: i18g2000pro.googlegroups.com; posting-host=123.3.133.108; posting-account=q18aiAoAAADbiIPIlD5R8oYVGhuoBvVA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729),gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:7121 Date: 2009-07-17T16:25:10-07:00 List-Id: On Jul 18, 12:28=A0am, Hibou57 (Yannick Duch=EAne) 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 =93 > anonymous type =94, 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 =93 access My_Type'Class =94, you nearly > do not have to bother about anything, but if you see it wants a =93 > My_Access_Type =94 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 =93 access My_Type'Class =94 is better beceause i= t > is =93 safer =94 (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 =93 access My_Type'Class =94 is better beceause i= t > is =93 safer =94 (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?