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=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.13.215.130 with SMTP id z124mr18057456ywd.16.1498924281112; Sat, 01 Jul 2017 08:51:21 -0700 (PDT) X-Received: by 10.36.3.81 with SMTP id e78mr190361ite.9.1498924281071; Sat, 01 Jul 2017 08:51:21 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!v31no1800438qtb.0!news-out.google.com!k7ni5409itk.0!nntp.google.com!v202no444794itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 1 Jul 2017 08:51:20 -0700 (PDT) In-Reply-To: <7f7a804e-b90d-4a60-b759-21ae14da3835@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=24.6.20.197; posting-account=Qh2kiQoAAADpCLlhT_KTYoGO8dU3n4I6 NNTP-Posting-Host: 24.6.20.197 References: <7f7a804e-b90d-4a60-b759-21ae14da3835@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Puzzled by SPARK global aspect From: Anh Vo Injection-Date: Sat, 01 Jul 2017 15:51:21 +0000 Content-Type: text/plain; charset="UTF-8" Xref: news.eternal-september.org comp.lang.ada:47252 Date: 2017-07-01T08:51:20-07:00 List-Id: On Friday, June 30, 2017 at 2:29:38 PM UTC-7, digitig wrote: > Suppose in my package specification I have > > type Quadrant_Specification_Array is > array(Global.Quadrant_X_Index'Range, Global.Quadrant_Y_Index'Range) > of Quadrant_Specification; > > (With QuadrantSpecification being a record type) and in my package body I have: > > function N_Total_Klingons return Global.Klingon_Counter > with > Refined_Global => (Input => Quadrant_Specifications) > is > Total: Global.Klingon_Counter := 0; > begin > for X in Quadrant_Specifications'Range loop > for Y in Quadrant_Specifications'Range(2) loop > Total := Total + Quadrant_Specifications(X, Y).N_Klingons; > end loop; > end loop; > return Total; > end N_Total_Klingons; > > Spark gives me an error > useless refinement, subprogram "N_Total_Klingons" does not depend on abstract state with visible refinement > > But if I take the Refined_Global specification out I get the error > > "Quadrant_Specifications" must be listed in the Global aspect of "N_Total_Klingons" > > I feel I'm losing either way - if I do specify it I'm wrong, if I don't specify it I'm wrong. > > How *do* I fix this? It is pretty hard to suggest advice since it is not a complete minimal code. In addition, I rather see the code instead of guessing. I would say your codes involve package Abstract State aspect. Anh Vo