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 Path: border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!aioe.org!.POSTED!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: SPARK Question Date: Tue, 07 May 2013 08:59:27 +0200 Organization: Ada @ Home Message-ID: References: <0efb385b-279a-49b7-8289-86b0e99e7930@googlegroups.com> NNTP-Posting-Host: /5uFWkegPs0CGJSoRIUiIw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/12.15 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 X-Original-Bytes: 1949 Xref: number.nntp.dca.giganews.com comp.lang.ada:181477 Date: 2013-05-07T08:59:27+02:00 List-Id: Le Wed, 01 May 2013 15:35:20 +0200, Phil Thornley = a =C3=A9crit: > Assuming you are using the latest version of SPARK, the simplest way t= o > do this is to also include the proof function Vec_Length in the body, > and give it a return annotation. So in the spec put: > > --# function Vec_Length (The_Vector : in Basic_Vector) > --# return Positive; > > function Get_Value > (The_Vector : in Basic_Vector; > At_Position : in Positive) > return Basis_Type; > --# PRE At_Position in Array_Range'First .. Vec_Length(The_Vector);= > That's exactly the kind of thing I miss with Ada 2012's Pre/Post: abilit= y = to define something for use in pre/post only, without injecting it in th= e = real program. That's finally what the above do. -- = =E2=80=9CSyntactic sugar causes cancer of the semi-colons.=E2=80=9D [1] =E2=80=9CStructured Programming supports the law of the excluded muddle.= =E2=80=9D [1] [1]: Epigrams on Programming =E2=80=94 Alan J. =E2=80=94 P. Yale Univers= ity