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,d00514eb0749375b X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder.news-service.com!feeder2.cambriumusenet.nl!feed.tweaknews.nl!138.195.8.3.MISMATCH!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: initialize an array (1-D) at elaboration using an expression based on the index? Date: Fri, 12 Nov 2010 12:10:09 -0600 Organization: Jacob Sparre Andersen Message-ID: References: <1f6bad81-e3d2-428b-a1a0-45acc7f96f68@m7g2000yqm.googlegroups.com> <9df4e5eb-fba7-4e8c-ba44-cd1ad4081d3b@26g2000yqv.googlegroups.com> <985a178c-8dfc-48af-9871-76a64750a571@l14g2000yqb.googlegroups.com> <2penc6lgsop1583vmg9i0m429ri4ajaf9n@4ax.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1289585412 12586 69.95.181.76 (12 Nov 2010 18:10:12 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 12 Nov 2010 18:10:12 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931 Xref: g2news1.google.com comp.lang.ada:15452 Date: 2010-11-12T12:10:09-06:00 List-Id: "Shark8" wrote in message news:d779c161-3199-45ca-87ae-d0501c74e219@26g2000yqv.googlegroups.com... >> ... having been raised on Algol-W I am delighted to see them come back. >> >> Is it their unfamiliarity that disturbs you? > > No, not so much. > I don't see how they are [strictly-speaking] necessary, given that we > have declare-blocks (which can be arbitrarily-nested). > Granted, they would make it a lot less verbose in many cases. {BTW, if > we're going to allow if/then statements inside expressions & > assignments/initializations then what's keeping us from using case- > statements too?} (Yes, Ada2012 has case expressions; coverage checking is important and not be be sacrificed just because you are writing an expression.) You can't write a declare block in a declarative part, inside of a pragma, or (for Ada 2012) inside of an aspect specification or expression function. The first is a significant problem in Ada 95; you have to write: Max_Value : constant Natural := Boolean'Pos()*TRUE_VALUE+ Boolean'Pos(not )*FALSE_VALUE; In order to get a static conditional expression. To claim that the above is at all understandable or readable is BS, plus it duplicates the expression. Max_Value : constant Natural := (if then TRUE_VALUE else FALSE_VALUE); is worlds better. And it gets even more fun if you have multiple cases... Randy.