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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!t2g2000yqn.googlegroups.com!not-for-mail From: Britt Newsgroups: comp.lang.ada Subject: Re: Why no named case statements? Date: Sun, 6 Sep 2009 10:46:26 -0700 (PDT) Organization: http://groups.google.com Message-ID: <26253452-b337-413c-9f7f-9e0a9b4f66fa@t2g2000yqn.googlegroups.com> References: <5233a224-07c1-4a7b-906e-b4cb8e193c85@y42g2000yqb.googlegroups.com> <1doe3xrcrqyeh.101b6gamg91bj.dlg@40tude.net> NNTP-Posting-Host: 207.191.204.27 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1252259186 4879 127.0.0.1 (6 Sep 2009 17:46:26 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 6 Sep 2009 17:46:26 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: t2g2000yqn.googlegroups.com; posting-host=207.191.204.27; posting-account=rdRzuwoAAAAyW3CSBhs_xgfCUJSc1aNt User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/530.5 (KHTML, like Gecko) Chrome/2.0.172.43 Safari/530.5,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:8197 Date: 2009-09-06T10:46:26-07:00 List-Id: On Sep 6, 7:44=A0am, Robert A Duff wrote: > "Dmitry A. Kazakov" writes: > > > Ada has labels: > > > <> > > =A0 =A0case Some_Variable is > > =A0 =A0 =A0 =A0... > > =A0 =A0end case; > > > <> > > =A0 =A0if Whatever then > > =A0 =A0 =A0 ... > > =A0 =A0end if: > > I prefer comments: > > =A0 =A0-- Decide this. > =A0 =A0case Some_Variable is > =A0 =A0 =A0 =A0... > =A0 =A0end case; > > =A0 =A0-- Decide that. > =A0 =A0if Whatever then > =A0 =A0 =A0 ... > =A0 =A0end if: > > To me, a label is a warning that gotos are lurking around the place. Labels are also useful as breakpoint targets if the compiler produces associated symbolic information that can then be used by the debugger. Using labels for this purpose is much better (more maintainable) than breaking on line numbers. Such permanent breakpoints are sometimes useful in formal white-box test procedures. SPARK was recently changed to allow use of Ada labels for this purpose (breakpoints, not gotos), and the GNATPP pretty-printer now has a new switch to format Ada labels on separate lines (as shown in Dmitry's example). The responses to my original question have been informative. I think I would still like for the next revision of Ada to allow a name on any multi-line construct that closes with an end keyword. This would make the language more symmetric, I think. It would also be useful if Ada IDEs included both names and labels in their outline view to facilitate source code navigation. - Britt