From: Phil Thornley <phil.jpthornley@gmail.com>
Subject: Re: SPARK GPL 2012 and generic, any hint?
Date: Sun, 8 Jul 2012 16:31:22 +0100
Date: 2012-07-08T16:31:22+01:00 [thread overview]
Message-ID: <MPG.2a639e787bfb664898969b@news.zen.co.uk> (raw)
In-Reply-To: slrnjvinh6.n7f.hugues@soekris-1.pinkyoogx.org
In article <slrnjvinh6.n7f.hugues@soekris-1.pinkyoogx.org>,
hugues@soekris-1.pinkyoogx.org says...
>
> Hi,
>
> I tried SPARK GPL 2012 with a small example for generic, but I keep getting
> syntax error, do I miss something obvious?
>
> The documentation lacks a complete example that can be processed, all I could
> find was limited code snippet :(
>
> Here is the code source (code taken from SPARK GPL 2012 documentation, i
> I simply added package stuff around)
>
> package Test is
>
> generic
> type T1 is range <>;
> type T2 is range <>;
> --# check T1'Last * T1'Last <= T2'Last and
> --# T1'First * T1'First <= T2'Last and
> --# T1'First * T1'First >= T2'First;
> function Square (X : T1) return T2;
> --# return R => R = T2 (X * X);
>
> end Test;
>
The instantion check isn't supported yet, and the subprogram must be at
library level.
The following code examines OK:
generic
type T1 is range <>;
type T2 is range <>;
function Square (X : T1) return T2;
--# return R => R = T2 (X * X);
Cheers,
Phil
next prev parent reply other threads:[~2012-07-08 15:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-08 10:17 SPARK GPL 2012 and generic, any hint? hugues
2012-07-08 15:31 ` Phil Thornley [this message]
2012-07-09 6:51 ` hugues
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox