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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,4876056933faf283,start X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!18g2000yqa.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Spark_IO: improving with postconditions? Date: Wed, 26 Aug 2009 01:57:05 -0700 (PDT) Organization: http://groups.google.com Message-ID: NNTP-Posting-Host: 137.138.182.236 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1251277025 25065 127.0.0.1 (26 Aug 2009 08:57:05 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 26 Aug 2009 08:57:05 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: 18g2000yqa.googlegroups.com; posting-host=137.138.182.236; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:7981 Date: 2009-08-26T01:57:05-07:00 List-Id: The Spark_IO package defines several procedures that "return" string values by filling the given String object and the end-of-sequence index value. This end-of-sequence parameter is consistently defined as: Stop : out Natural One example of such a function is: procedure Get_Line (File : in File_Type; Item : out String; Stop : out Natural); --# global in out Inputs; --# derives Inputs, --# Item, --# Stop from Inputs, File; --# declare delay; Wouldn't it be good to enhance this specification with additional: --# post Stop <= Item'Last; It would save the caller from one redundant check if the Stop value is ever used again as index into the returned string value. -- Maciej Sobczak * www.msobczak.com * www.inspirel.com Database Access Library for Ada: www.inspirel.com/soci-ada