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,86c750b8474bf6d5 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: About String Date: Sun, 08 Jun 2008 14:32:36 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <484ABED3.8040909@obry.net> <484b802a$0$23844$4f793bc4@news.tdc.fi> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1212949956 23775 192.74.137.71 (8 Jun 2008 18:32:36 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Sun, 8 Jun 2008 18:32:36 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:qCUbrpKW8rJHJWvCtdGyFkSfJcQ= Xref: g2news1.google.com comp.lang.ada:617 Date: 2008-06-08T14:32:36-04:00 List-Id: Niklas Holsti writes: > Chris Moore wrote: >> I have to say this is an entirely non-intuitive "feature" of the language. > > I beg to differ. The program should be read as > > declare > begin end; > > The exception handler is within the "begin..end" block, not on the > "declare". Sure, that's right, but the syntax doesn't make it clear. We have ample proof that this syntax is confusing: More than one person in this thread has admitted to being confused -- QED. ;-) I think it was a mistake to attach exception handlers to declare blocks and procedures and so forth. Instead, there should be a single statement for handling exceptions, as in Java and other languages. Something like: handle ... statements ... exception when ... => ... end; >... (Indenting the "begin..exception..end" structure one level > beyond the "declare" would make this more visible, but is not common > practice.) And it violates the recommended indentation defined by the RM. Anyway, surely "end" belongs at the same column as "declare" or "procedure" or whatever it's ending. > I wonder if it would be a good idea for Ada to allow an exception > handler also in the "declare" part, as follows: That goes in the opposite direction I suggested above. I think it would add confusion. - Bob