From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,103b49cd5a4719fd X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nntp.club.cc.cmu.edu!feeder.erje.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: SPARK - Bubble Sort on Rosetta Code Date: Thu, 26 Aug 2010 23:32:08 +0100 Organization: A noiseless patient Spider Message-ID: References: <5688938b-2047-4fef-9ea2-730abb761d07@g17g2000yqe.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Thu, 26 Aug 2010 22:32:10 +0000 (UTC) Injection-Info: mx03.eternal-september.org; posting-host="KCXegvZb5vh43D+f3BR6Ew"; logging-data="20103"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+T31RuNzO15U2UxPN56k+8u2icbx16AZg=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (darwin) Cancel-Lock: sha1:h2Z0S2jhWK00ccLd6mC1hdle2iQ= sha1:My0gyLRGo07+oszFpJ/T1h9Vg5o= Xref: g2news1.google.com comp.lang.ada:13765 Date: 2010-08-26T23:32:08+01:00 List-Id: Phil Thornley writes: > I've put some SPARK code for the Bubble Sort task on Rosetta Code and > I would welcome opinions on whether they make a good showcase for > SPARK It took me a while to find them -- at http://rosettacode.org/wiki/Sorting_algorithms/Bubble_sort#SPARK. > The first is simply shown to be type-safe. Is this the same as "guaranteed free of any run-time error"? What would non-SPARK code do to make it fail? > The second, with identical Ada code, proves that the output array is > sorted. Are zero-length arrays forbidden in SPARK? I ask because of --# check A'Last <= A'First -> A'Last = A'First; (what's that -> ? I understood that the syntax was 'check ').