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-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!f20g2000prn.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Why no named case statements? Date: Fri, 4 Sep 2009 16:47:03 -0700 (PDT) Organization: http://groups.google.com Message-ID: <7c9ffecd-a797-44c0-90be-b8d8202aabba@f20g2000prn.googlegroups.com> References: <5233a224-07c1-4a7b-906e-b4cb8e193c85@y42g2000yqb.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1252108024 798 127.0.0.1 (4 Sep 2009 23:47:04 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 4 Sep 2009 23:47:04 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: f20g2000prn.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618),gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:8171 Date: 2009-09-04T16:47:03-07:00 List-Id: On Sep 4, 4:06=A0pm, Britt Snodgrass wrote: > Ada allows optional names for loops and declare blocks but not for > case or if statetements. Why not, since these are also multi-line > statements that terminate with an 'end" keyword? Probably because for loops and blocks, the names are useful for something else. For loops, you can specify the loop name in an EXIT statement (useful if you nest loops and want to exit the outer one). For blocks, the block name can be used as part of an expanded name (i.e. if you declare a variable V in the declaration portion of the declare block, you can refer to Block_Name.V). My guess is that since the names were needed for those purposes for loops and blocks, but not for anything else, the original language designers didn't bother to allow them for other compound statements. I sometimes use loop > names to clearly indicate the purpose of the loop and have wished I > could do the same for case statements, e.g., > > Decide_This: > case Some_Variable is > ... > end case Decide_This; > > or similarly for long if statements: > > Decide_That: > if Whatever then > ... > end if Decide_That: I'd just use comments. -- Decide_This: case Some_Variable is ... end case; -- Decide_This -- Adam