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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.36.117.83 with SMTP id y80mr4477630itc.48.1510932971966; Fri, 17 Nov 2017 07:36:11 -0800 (PST) X-Received: by 10.157.95.5 with SMTP id f5mr101796oti.9.1510932971892; Fri, 17 Nov 2017 07:36:11 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!weretis.net!feeder4.news.weretis.net!news.roellig-ltd.de!open-news-network.org!peer02.am4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!d140no1205209itd.0!news-out.google.com!193ni1900iti.0!nntp.google.com!i6no1081724itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 17 Nov 2017 07:36:11 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=155.148.6.150; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 155.148.6.150 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Tests in a software release From: Shark8 Injection-Date: Fri, 17 Nov 2017 15:36:11 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Body-CRC: 2360235407 X-Received-Bytes: 2769 Xref: feeder.eternal-september.org comp.lang.ada:48962 Date: 2017-11-17T07:36:11-08:00 List-Id: On Wednesday, November 15, 2017 at 1:46:35 PM UTC-7, Dmitry A. Kazakov wrote: > On 2017-11-15 18:57, G. B. wrote: > > > The most important thing is, designing by contract > > is *not* programming defensively. > > It exactly is. In both cases no assumptions beyond known preconditions > are made. Ada was especially designed to uphold defensive programming. > E.g. case requires others alternative: > > I : Positive := 1; > > case I is > when 1 => > ... > when others => -- Defensive and mandatory > ... > end case; Except that Ada allows CASE to be non-defensive and natural operation over sets: Example : Integer with Import, Address => SOME_PORT; Subtype Negative is Integer range Integer'First..Integer'Pred(Natural'First); Subtype Small_Prime is Positive range Positive'Succ(Positive'First)..2**5 with Static_Predicate => Small_Prime in 2 | 3 | 5 | 7 | 11 | 13 | 17 | 19 | 23 | 29 | 31; Case Example is when Negative => Do_Negative; when 0 => Do_Zero; when 1 => Do_One; when Small_Prime => Do_Prime; when others => Do_Positive_General; End Case;