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,744136b4fae1ff3e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-03-11 02:14:20 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: rod.chapman@praxis-cs.co.uk (Rod Chapman) Newsgroups: comp.lang.ada Subject: Re: [Spark] Converting Arrays Date: 11 Mar 2003 02:14:19 -0800 Organization: http://groups.google.com/ Message-ID: References: NNTP-Posting-Host: 213.155.153.242 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1047377660 20404 127.0.0.1 (11 Mar 2003 10:14:20 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 11 Mar 2003 10:14:20 GMT Xref: archiver1.google.com comp.lang.ada:35174 Date: 2003-03-11T10:14:20+00:00 List-Id: "Out" mode unconstrained arrays are indeed an interesting part of SPARK. They have the rather unusual property of having a value which is not well-defined in such a body, but having attributes (i.e. 'First and 'Last) which do have well-defined values. A common trick in this case is to use a local, hidden procedure to initialise the out parameter: package body test is procedure To_Fullpath (s : String; path : out Fullpath) is procedure Init_Path; --# global out Path; --# derives Path from ; is --# hide Init_Path; begin Path := (others => ASCII.NUL); -- note Ada95 not SPARK! end Init_Path; -- Warning 10 expected here - hidden body. begin Init_Path; ... -- as before... end To_Fullpath; end test; This is a fine example of "moving the SPARK boundary" for perfectly good reasons. You can even Inline such a local procedure if efficiency is as issue. - Rod, SPARK Team