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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c8d893e8045967db X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-04-23 03:52:59 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!news-lond.gip.net!news-FFM2.ecrc.net!news.iks-jena.de!not-for-mail From: Lutz Donnerhacke Newsgroups: comp.lang.ada Subject: Re: [Spark] Using defered constants Date: Wed, 23 Apr 2003 10:52:58 +0000 (UTC) Organization: IKS GmbH Jena Message-ID: References: <3EA65CA6.5010705@praxis-cs.co.uk> NNTP-Posting-Host: taranis.iks-jena.de X-Trace: branwen.iks-jena.de 1051095178 15040 217.17.192.37 (23 Apr 2003 10:52:58 GMT) X-Complaints-To: usenet@iks-jena.de NNTP-Posting-Date: Wed, 23 Apr 2003 10:52:58 +0000 (UTC) User-Agent: slrn/0.9.7.4 (Linux) Xref: archiver1.google.com comp.lang.ada:36399 Date: 2003-04-23T10:52:58+00:00 List-Id: * Peter Amey wrote: > Lutz's question has caused me to reconsider all this and the next release > of the Examiner will relax these rules so that after the point that Ada > requires that the deferred constant to be complete it can be used even if > the SPARK Examiner has not seen it (because it is hidden). Thank you very much. > The worst consequence for the Examiner will be the ability to construct > programs with hidden pakcage private parts that will examine cleanly but > not compile because soemthing in the hidden part makes them illegal Ada; > at least this is "safe". Of course. You can't check hidden areas. If you would do so, you would not need the argument of #hide, because then you can determine the closure of the hidden region yourself. > As with all these things, it is feedback from active users that drive > things forward! I'm not an active user. I'm just playing with Spark and Ada. Back to the original problem. A simple workaround is to replace the constant by a parameterless (inlined) function. package t is type x is private; function cx return x; procedure copy(o : out x; i : Integer); --# derives o from i; private --# hide t; type x is new Integer; end t; package body t is function cx return x is --# hide cx; begin return 0; end cx; procedure doupdate(o : in out x; i : Integer) --# derives o from i, o; is --# hide doupdate; begin o := o + x(i); end doupdate; procedure copy(o : out x; i : Integer) is begin o := cx; doupdate(o, i); end copy; end t;