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.182.250.233 with SMTP id zf9mr10875643obc.7.1444394104174; Fri, 09 Oct 2015 05:35:04 -0700 (PDT) X-Received: by 10.182.247.71 with SMTP id yc7mr77689obc.31.1444394104124; Fri, 09 Oct 2015 05:35:04 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!kq10no18905708igb.0!news-out.google.com!n2ni25110igy.0!nntp.google.com!kq10no18905699igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 9 Oct 2015 05:35:03 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=193.163.1.105; posting-account=Srm5lQoAAAAEMX9rv2ilEKR6FDPapmSq NNTP-Posting-Host: 193.163.1.105 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <9c3de690-e770-412e-b78f-4d254694ffcc@googlegroups.com> Subject: Re: SPARK: missing case value From: Mark Lorenzen Injection-Date: Fri, 09 Oct 2015 12:35:04 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:27945 Date: 2015-10-09T05:35:03-07:00 List-Id: On Friday, October 9, 2015 at 1:38:35 PM UTC+2, Maciej Sobczak wrote: > On the other hand, SPARK is supposed to be a subset of Ada, so even if th= e above is feasible from the SPARK point of view, it should compile as regu= lar Ada as well and compilers are not required to do this level of static a= nalysis. So, SPARK does not do it, because Ada might not be able to keep th= e pace. >=20 > What are your thoughts on this? I think it is logical and correct. How would a compiler be able to determin= e the range of E if your precondition was more complex? I would change the case statement into something like this: case E is when A =3D> null; when B =3D> null; when C =3D> raise Impossible; -- or maybe Pragma Assert (False) end case; Note that you can use raise statements in SPARK as long as the program is s= till in SPARK i.e. the raise statement will never be executed. Regards, Mark L