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,fc52c633190162e0 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!feeder.news-service.com!68.142.88.77.MISMATCH!hwmnpeer03.ams!news.highwinds-media.com!hitnews.eu!news.taunusstein.net!open-news-network.org!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Use of declare blocks Date: Thu, 22 Mar 2007 21:35:39 -0500 Organization: Jacob's private Usenet server Message-ID: References: <1172144043.746296.44680@m58g2000cwm.googlegroups.com> <1172161751.573558.24140@h3g2000cwc.googlegroups.com> <546qkhF1tr7dtU1@mid.individual.net> <5ZULh.48$YL5.40@newssvr29.news.prodigy.net> <4eeMh.16400$bb1.2557@newssvr17.news.prodigy.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: jacob-sparre.dk 1174617246 16457 69.95.181.76 (23 Mar 2007 02:34:06 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 23 Mar 2007 02:34:06 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1807 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 Xref: g2news1.google.com comp.lang.ada:14601 Date: 2007-03-22T21:35:39-05:00 List-Id: wrote in message news:bByMh.11141$P47.10468@newssvr22.news.prodigy.net... ... > When used by someone such as Randy, a programmer who > uses every construct with care and intelligence, the declare > block is not a primay design structure but a way of bringing > subtle refinement to an already good design. Richard, thanks for the vote of confidence. But I have to admit that the above gave me a good laugh. My code tends to look just like the things you describe you don't like (especially in the Janus/Ada compiler), especially in regards to long subprograms. Part of that comes from the nature of compiling: it's impossible to usefully shorten case statements with dozens of branches. And I'm sure another part comes from Janus/Ada having started as a university project, where things like naming and encapsulation weren't used consistently (the latter because separate compilation was very weak in our early tools). I just looked a couple of favorites: Gen_Name (which generates the code for Ada "names") is 950 lines long, and it is mostly made up of calls to other things. The root semantic routine is 2700 lines long (it's a just a giant case statement with 378 whens at this writing: it decides what to do with each grammar production as it is recognized). Anyway, I do understand the readability concerns, but I think they're overblown. If you have to look 5 pages away to find a variable declaration, the readability of the code it is used in isn't necessarily enhanced: you're still flipping back and forth. Moreover, trying to come up with good names for code that are made into subprograms just to keep the code "short" is hard, and I know I'm not good at it. These supposed helpers are a real headache during maintenance, because its rarely obvious what they do! How do that help readability?? Randy.