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,FREEMAIL_FROM autolearn=ham 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!k19g2000yqn.googlegroups.com!not-for-mail From: =?ISO-8859-1?Q?Hibou57_=28Yannick_Duch=EAne=29?= Newsgroups: comp.lang.ada Subject: Re: Access types as parameters Date: Fri, 17 Jul 2009 09:28:11 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <521c4843-d40f-4545-9e80-ca725e847090@h21g2000yqa.googlegroups.com> NNTP-Posting-Host: 77.198.58.183 Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1247848091 30314 127.0.0.1 (17 Jul 2009 16:28:11 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 17 Jul 2009 16:28:11 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: k19g2000yqn.googlegroups.com; posting-host=77.198.58.183; posting-account=vrfdLAoAAAAauX_3XwyXEwXCWN3A1l8D User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; fr),gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:7114 Date: 2009-07-17T09:28:11-07:00 List-Id: 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 it 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.