comp.lang.ada
 help / color / mirror / Atom feed
From: "Yannick Duchêne (Hibou57)" <yannick_duchene@yahoo.fr>
Subject: Re: SPARK Question
Date: Tue, 07 May 2013 08:59:27 +0200
Date: 2013-05-07T08:59:27+02:00	[thread overview]
Message-ID: <op.wwpcddnbule2fv@cardamome> (raw)
In-Reply-To: MPG.2beb2a4dab7f2a819896a7@news.zen.co.uk

Le Wed, 01 May 2013 15:35:20 +0200, Phil Thornley  
<phil.jpthornley@gmail.com> a écrit:
> Assuming you are using the latest version of SPARK, the simplest way to
> 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: ability  
to define something for use in pre/post only, without injecting it in the  
real program. That's finally what the above do.

-- 
“Syntactic sugar causes cancer of the semi-colons.” [1]
“Structured Programming supports the law of the excluded muddle.” [1]
[1]: Epigrams on Programming — Alan J. — P. Yale University


  reply	other threads:[~2013-05-07  6:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-01  8:35 SPARK Question M. Enzmann
2013-05-01 13:35 ` Phil Thornley
2013-05-07  6:59   ` Yannick Duchêne (Hibou57) [this message]
2013-05-07  7:54     ` Georg Bauhaus
2013-05-07 20:44       ` Jacob Sparre Andersen news
2013-05-19 18:54         ` phil.clayton
2013-05-20 23:40           ` Randy Brukardt
2013-05-02  5:48 ` M. Enzmann
  -- strict thread matches above, loose matches on Subject: below --
2018-08-27 14:10 SPARK question Simon Wright
2018-08-27 16:39 ` Shark8
2018-08-27 20:19   ` Simon Wright
2018-08-27 21:36     ` Randy Brukardt
2018-08-28 19:05       ` Simon Wright
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox