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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9f99a33281d5072c X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news3.google.com!feeder2.cambriumusenet.nl!feed.tweaknews.nl!193.201.147.85.MISMATCH!border-2.ams.xsnews.nl!feed.xsnews.nl!border-4.ams.xsnews.nl!193.141.40.65.MISMATCH!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: When a conditional expression is static, where can it be used? Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <4c2b1ecb$0$7670$9b4e6d93@newsspool1.arcor-online.net> <555e3a37-c709-4b9b-995a-907da862d4b7@m40g2000prc.googlegroups.com> Date: Wed, 30 Jun 2010 19:35:38 +0200 Message-ID: <12ok8wnj6k4sw$.ravumwbhfb1h$.dlg@40tude.net> NNTP-Posting-Date: 30 Jun 2010 19:35:36 CEST NNTP-Posting-Host: 2737186b.newsspool4.arcor-online.net X-Trace: DXC=:=69l5M@@`1U`5g[@c]@J14IUK[^0SV3ak:F<88A`XR0O\l2 X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:12046 Date: 2010-06-30T19:35:36+02:00 List-Id: On Wed, 30 Jun 2010 07:39:24 -0700 (PDT), Adam Beneschan wrote: > On Jun 30, 3:39�am, Georg Bauhaus > wrote: >> A totally meaningless example just to illustrate >> the question: �What is it that a compiler must report >> for the case statement below, if anything? > > The choice "Sa" is not covered by any alternative. Other than that, I > don't think there's anything wrong with the CASE statement, and if you > had included a "when others =>" alternative I think it would be > legal. I'm not sure what potential problem you were trying to > illustrate. Let me propose this one instead: � �type DOW is (Mo, Tu, We, Th, Fr, Sa, So); � �case D is � � � when (if D = Mo then Tu else Mo) => P; � � � when (if D = Tu then Tu else Mo) => Q; � � � when We..So => R; � �end case; The above is equivalent to: � �case D is � � � when Tu => P; � � � when Mo => Q; � � � when We..So => R; � �end case; But as Pascal suggested, it should not compile because D is not static. As for the problem Georg had in mid. Maybe it is this. Let you have some function, say Gamma function. Now, x : constant := 0.1; Gx : constant := Gamma (1.1); -- Illegal, what a pity Let us open the table of Gamma, scan it, and write something like: (if x < 0.0 then ... elsif x < 0.01 then ... ) This wonderful static function can then copied and pasted everywhere you wanted to evaluate Gamma at compile time. Is it legal? -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de