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.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,bc2c82b1e5c6fe83 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.129.133 with SMTP id nw5mr8428659pbb.3.1330266358129; Sun, 26 Feb 2012 06:25:58 -0800 (PST) Path: h9ni11564pbe.0!nntp.google.com!news2.google.com!news4.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Question about out parameters of unconstrained array type. Date: Sun, 26 Feb 2012 16:25:56 +0200 Organization: Tidorum Ltd Message-ID: <9qutnkFtm2U1@mid.individual.net> References: <4NedncPWdPN9GtTS4p2dnAA@giganews.com> <20120226132532.7fb8ec1b@t60> Mime-Version: 1.0 X-Trace: individual.net OdSY4dDZSJN4Y3BU8BupoAK7FtyLpxv8rK/8Kxn7exrH/h3KQF Cancel-Lock: sha1:RjKfEH7HbGk60SAyTmj8nxA6HCM= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 In-Reply-To: <20120226132532.7fb8ec1b@t60> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2012-02-26T16:25:56+02:00 List-Id: On 12-02-26 14:25 , Alexander Senier wrote: > On Sun, 26 Feb 2012 09:14:53 -0000 > Phil Thornley wrote: > >> For your code above, if the cost of including the initialization of the >> array is too high then the easiest way to remove the the error is >> probably to add another parameter that is the length of the Description >> string. Using Alexander's code: > > Can anybody comment on the legality of using attributes of an out parameter of > an unconstrained (array) type in Ada? A brief skim through LRM could not > enlighten me... It is entirely legal. Before an object can be passed as a parameter, the object must exist; when the object exists, all its attributes are defined (and the object is constrained, of course). As you, I did not find a specific statement about the attributes of "out" parameters in the LRM. But 3.6.2(5) says that A'Length is defined for any array object A. Since this rule makes no exception for objects that are "out" parameters, they too have a 'Length. > > If using 'Length (and other attributes) elsewhere than in a loop constraint > actually is legal Ada, than this seems like an unnecessary limitation of SPARK > that should be relaxed. When I looked at SPARK a couple of years ago, I felt it had several such annoying and (at least seemingly) unnecessary limitations. As I recall, many limitations seemed to me to be relicts of the earlier Pascal-based SPARK ancestor, where the extension to Ada took the path of least effort, in the sense that SPARK allows simple Pascal-like Ada code while rejecting semantically equivalent but more Ada-like code. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .