comp.lang.ada
 help / color / mirror / Atom feed
* SPARK constants across packages
@ 2009-06-07 16:53 xorquewasp
  2009-06-07 17:21 ` Phil Thornley
  0 siblings, 1 reply; 3+ messages in thread
From: xorquewasp @ 2009-06-07 16:53 UTC (permalink / raw)


SPARK appears to forbid this:

  X : constant Integer := P.Y;

Where Y is a constant of the same type defined in package P;
The grammar for SPARK 95 specifies that only a
static_simple_expression can appear after the assignment
operator for constant declarations.

Is there a particular reason that SPARK doesn't allow this?



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: SPARK constants across packages
  2009-06-07 16:53 SPARK constants across packages xorquewasp
@ 2009-06-07 17:21 ` Phil Thornley
  2009-06-07 17:34   ` xorquewasp
  0 siblings, 1 reply; 3+ messages in thread
From: Phil Thornley @ 2009-06-07 17:21 UTC (permalink / raw)


On 7 June, 17:53, xorquew...@googlemail.com wrote:
> SPARK appears to forbid this:
>
>   X : constant Integer := P.Y;
>
> Where Y is a constant of the same type defined in package P;
> The grammar for SPARK 95 specifies that only a
> static_simple_expression can appear after the assignment
> operator for constant declarations.
>
> Is there a particular reason that SPARK doesn't allow this?

The place to look first for any "why does SPARK excluded this"
question is Section 4 of the SPARK95 manual - "Considerations in the
Refinement of the Ada Subset".

For this particular query the answer is (in 4.1) that the meaning of
the program must not be changed by different orders of elaboration.
"This particular problem is overcome in SPARK by the restrictions
imposed on ... initialization expressions."

Cheers,

Phil Thornley



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: SPARK constants across packages
  2009-06-07 17:21 ` Phil Thornley
@ 2009-06-07 17:34   ` xorquewasp
  0 siblings, 0 replies; 3+ messages in thread
From: xorquewasp @ 2009-06-07 17:34 UTC (permalink / raw)


Phil Thornley wrote:
> The place to look first for any "why does SPARK excluded this"
> question is Section 4 of the SPARK95 manual - "Considerations in the
> Refinement of the Ada Subset".

Oh, right.

> For this particular query the answer is (in 4.1) that the meaning of
> the program must not be changed by different orders of elaboration.
> "This particular problem is overcome in SPARK by the restrictions
> imposed on ... initialization expressions."

Thanks.

Perhaps SPARK 05 might stretch to allowing this when the source
value is in a Pure package.

Perhaps not.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-06-07 17:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-07 16:53 SPARK constants across packages xorquewasp
2009-06-07 17:21 ` Phil Thornley
2009-06-07 17:34   ` xorquewasp

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