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-7-bit X-Google-Thread: 103376,38fc011071df5a27 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-07 16:04:13 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc53.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Ideas for Ada 200X References: X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 12.234.13.56 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc53 1055027051 12.234.13.56 (Sat, 07 Jun 2003 23:04:11 GMT) NNTP-Posting-Date: Sat, 07 Jun 2003 23:04:11 GMT Organization: AT&T Broadband Date: Sat, 07 Jun 2003 23:04:11 GMT Xref: archiver1.google.com comp.lang.ada:38795 Date: 2003-06-07T23:04:11+00:00 List-Id: >>> Add(A, C); >> And the person reading this code couldn't be sure what was going on in >> "Add" without looking at the procedure itself (or perhaps its >> declaration). How would the reader know if the sum will end up in the >> first or second argument? "Come the revolution, comrade, we'll all do it my way, with the assignee on the left." ;) If the reader is in doubt, he will indeed have to look at the spec of procedure Add to know what it is supposed to do. If Add is used in only a very few places, then a good Ada programmer would go to the trouble of writing it out the long way, with named parameter association. If Add is used a lot, it's more reasonable to lessen verbosity and instead require the reader to look up the definition of procedure Add, and use positional parameters. Of course it may be that Add actually sets its first parameter to all zeros or something, but that could also happen if a compiler translated "A += B;" to "Add(A,B);" > That's why this Ada programmer (good or bad, I won't say!) > would write it as > > A := B; > Add (Into => A, C); At which point his compiler would gently point out that once (from left to right) you've started using named parameters you can't go back to positional, so he needs to write Add (Into => A, Increment => C); or Add (A, Increment => C); Of course it's also true that once you've changed A := B+C+D; to some series of "+=" or "Add"s, you've made things obscure and hard to read, in favor of the speedup you needed. Anytime he lessens readability, the good Ada programmer will put in comments explaining what he is doing and why he is doing it this non-straightforward way.