comp.lang.ada
 help / color / mirror / Atom feed
* Re: [Spark] Converting Arrays
@ 2003-03-13  5:55 Grein, Christoph
  2003-03-13  9:47 ` Peter Amey
  0 siblings, 1 reply; 18+ messages in thread
From: Grein, Christoph @ 2003-03-13  5:55 UTC (permalink / raw)
  To: comp.lang.ada

> The restriction that an out mode parameter can't be referenced in a 
> precondition seems to be the major cause of the difficulty, and I have 
> (reluctantly) come to the conclusion that the way to avoid explicit 
> rules for each instance of the output parameter is to pass the length as 
> an additional parameter, as Rod suggests.

I've never used SPARK myself, but I've read the PDF excerpt of Barnes' book with 
interest.

I'm wondering whether it wouldn't be feasible to change the SPARK rules in such 
a way to allow references of attributes of out parameters in preconditions. 
(Even in Ada 83, where reading of out parameters was forbidden, reading of their 
attributes and discriminants was allowed - and for a good reason.)



^ permalink raw reply	[flat|nested] 18+ messages in thread
* [Spark] Converting Arrays
@ 2003-03-10 17:06 Lutz Donnerhacke
  2003-03-10 20:03 ` James S. Rogers
  2003-03-11 10:14 ` Rod Chapman
  0 siblings, 2 replies; 18+ messages in thread
From: Lutz Donnerhacke @ 2003-03-10 17:06 UTC (permalink / raw)


I run into a difficult problem (for me):
$ cat test.ada <<END
package test is
   type Fullpath is array(Positive range <>) of Character; 
   procedure To_Fullpath (s : String; path : out Fullpath);    
   --# derives path from s;       
end test;

package body test is
   procedure To_Fullpath (s : String; path : out Fullpath) is 
   begin    
      path := Fullpath'(others => ASCII.NUL);       
      for i in Positive range 1 .. s'Length loop             
        path (path'First + i) := s (s'First + i);        
      end loop;
   end To_Fullpath;
end test;
END
$ spark test.ada
          *******************************************************
       SPARK95 Examiner with VC and RTC Generator Release 6.3 / 11.02
                           Demonstration Version
          *******************************************************


                       DATE : 10-MAR-2003 18:05:17.49


           Examining the specification of package test ...

           Examining the body of package test ...

  10        path := Fullpath'(others => ASCII.NUL);
            ^
***   Semantic Error    : 39: Illegal use of unconstrained type.
                    ^
***   Semantic Error    : 39: Illegal use of unconstrained type.
                    ^
***   Semantic Error    : 39: Illegal use of unconstrained type [Barnes 6.7].

           Generating listing file test.lst ...

           Generating report file ...


-----------End of SPARK Examination--------------------------------


Any idea, how to write this correctly?



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

end of thread, other threads:[~2003-03-21 15:17 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-13  5:55 [Spark] Converting Arrays 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
  -- strict thread matches above, loose matches on Subject: below --
2003-03-10 17:06 Lutz Donnerhacke
2003-03-10 20:03 ` James S. Rogers
2003-03-10 22:33   ` Lutz Donnerhacke
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

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