comp.lang.ada
 help / color / mirror / Atom feed
From: Lutz Donnerhacke <lutz@iks-jena.de>
Subject: Re: [Spark] Converting Arrays
Date: Mon, 10 Mar 2003 22:33:38 +0000 (UTC)
Date: 2003-03-10T22:33:38+00:00	[thread overview]
Message-ID: <slrnb6q4m2.nvj.lutz@belenus.iks-jena.de> (raw)
In-Reply-To: 1c6ba.19009$Oz1.770240@bgtnsc05-news.ops.worldnet.att.net

* James S. Rogers wrote:
> "Lutz Donnerhacke" <lutz@iks-jena.de> wrote in message
>> I run into a difficult problem (for me):
> 
> change the initialization of "path" as follows:
> 
> path := (others => ASCII.NUL);

path := (1 .. s'Length => s, others => ASCII.NUL);
would be the approbriate Ada construct.

But I do not talk about Ada. I talk about the Spark subset of Ada which
refuses such construct because:
  - it's a untyped aggragate (illegal in Spark).
  - constains non static components (slicing in illegal in Spark).
  - assignes to non statically known bounds. (illegal in Spark).

> Note that another problem looms in your code.
> The "for" loop will attempt to access one element
> beyond the end of string "s".

Yep. Spark would found this later. But currently it refuses the construct as
a whole. What does not compile, is already erronous. ;-)

> It appears that you are trying to copy s into path
> while skipping the first element of s. This can be done
> more directly and correctly with array slices:

Slicing is illegal in Spark.

A possible solution is to assign the values in two loops. But Spark refuses
this construct, too, because the data flow analysis handle arrays as a
single variable and therefore compains about uninitialized values, reuse of
uninitialized values and contradiction to the predicted information flow.

> You will need to decide how to handle the case when
> path is shorter than s.

Very simple: I have a precondition on the specification claiming that s is
really shorter than path, so on every call to this function, Spark proofs
that this procedure will not fail due to unexpected parameters.

I fear, that I have to use a constraint array type for out variables. :-(



  reply	other threads:[~2003-03-10 22:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-10 17:06 [Spark] Converting Arrays Lutz Donnerhacke
2003-03-10 20:03 ` James S. Rogers
2003-03-10 22:33   ` Lutz Donnerhacke [this message]
2003-03-11 10:14 ` Rod Chapman
2003-03-11 10:51   ` Lutz Donnerhacke
2003-03-11 10:52   ` Lutz Donnerhacke
2003-03-11 20:46     ` JP Thornley
2003-03-12  8:43       ` Phil Thornley
2003-03-12 11:57         ` Lutz Donnerhacke
2003-03-12 18:46           ` JP Thornley
2003-03-13 10:14             ` Lutz Donnerhacke
2003-03-12  9:43     ` Rod Chapman
2003-03-12 10:15       ` Lutz Donnerhacke
  -- strict thread matches above, loose matches on Subject: below --
2003-03-13  5:55 Grein, Christoph
2003-03-13  9:47 ` Peter Amey
2003-03-13 10:15   ` Lutz Donnerhacke
2003-03-21 15:05     ` Peter Amey
2003-03-21 15:17       ` Lutz Donnerhacke
replies disabled

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