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 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: I'm facing an issue with: call to abstract procedure must be dispatching Date: Tue, 8 Dec 2015 15:55:23 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <8bc7fd76-f00a-4eea-9715-470af028fc84@googlegroups.com> <1krm4xun4e4ny.jmh9kvf6s0a9.dlg@40tude.net> <12dc7aea-933d-4271-95bd-10df808917e4@googlegroups.com> <5hfb2q9imjfu.zs3xp9gxw0d3.dlg@40tude.net> <5788b259-8886-4ee2-8c3d-7799abfd840e@googlegroups.com> <14acd8b0-a5e9-40fd-b7cc-d319f914d507@googlegroups.com> <112596d0-d4ee-46e9-a02d-8de837aff352@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Injection-Date: Tue, 8 Dec 2015 22:52:58 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="caa759af2a9c666aec02942f6fe5abd6"; logging-data="4027"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19d2bhBklQNa+eXVVXorql6iph+W0/Sj4A=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 In-Reply-To: Cancel-Lock: sha1:P1lBcYnlcMt5sML3d+aJtUNyOFQ= X-Enigmail-Draft-Status: N1110 Xref: news.eternal-september.org comp.lang.ada:28723 Date: 2015-12-08T15:55:23-07:00 List-Id: On 12/08/2015 03:43 PM, Serge Robyns wrote: > > Now I've a generic question with regards to access type vs. in-out for parameters. What is the proper Ada way to pass the "Store" around? > Is it: > Procedure Do_Something (A_Store : in out T_Abstract_Store'Class); > or: > Procedure Do_Something (A_Store : not null access T_Abstract_Store'Class); > ? > > As a former C programmer my habit goes for the not null access variant. As an Ada S/W engineer, you should use "in out". With "in out", the compiler does the work of passing the object in such a way that the operation can read and modify the value. With an access, you (or whoever calls your operation) has to do extra work to have an access value to pass. It's unnecessary extra work and an extra chance to get something wrong, and so to be avoided. -- Jeff Carter "Your mother was a hamster and your father smelt of elderberries." Monty Python & the Holy Grail 06