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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,8f802583e5c84fa X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!g47g2000cwa.googlegroups.com!not-for-mail From: "Steve Whalen" Newsgroups: comp.lang.ada Subject: Re: String filtering Date: 3 Oct 2005 03:06:22 -0700 Organization: http://groups.google.com Message-ID: <1128333982.964574.162950@g47g2000cwa.googlegroups.com> References: <1j92wa9843ylq.16j89wuqatbaj$.dlg@40tude.net> <1b54lwg8s1gk8.1t3jp1cmc2x32$.dlg@40tude.net> <1128236249.692858.50370@g14g2000cwa.googlegroups.com> NNTP-Posting-Host: 68.238.133.26 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1128333988 25743 127.0.0.1 (3 Oct 2005 10:06:28 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 3 Oct 2005 10:06:28 +0000 (UTC) In-Reply-To: User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.11) Gecko/20050728,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: g47g2000cwa.googlegroups.com; posting-host=68.238.133.26; posting-account=GBMmzA0AAABrZ0dHOASa3b2Cdf-RliH9 Xref: g2news1.google.com comp.lang.ada:5352 Date: 2005-10-03T03:06:22-07:00 List-Id: Robert A Duff wrote: > ... Ada allows side effects in functions. ... ... [Good examples of idioms where permitting "out" parameters in functions would aid clarity of Ada code snipped out] [examples included recursive descent parsers, "get token" or "get line" type functions, and function parameter initializations] ... Thanks for the explanation. You've sold me. I was leaning toward Tucker's position that "out" parameters had no place in Ada, but now I think they probably should be allowed (especially since the other kinds of side effects functions are allowed to have are probably generally worse and have to found using other tools or code inspections anyway). If I'm managing a project and want to see where programmers used "out" parameters in functions (if they were allowed), I could run an ASIS based tool to find them and review them to be sure the programmer was making sensible use of the (proposed) feature (as in your examples) and not getting "cute". ... > - Bob > > P.S. "Side effect" is a pejorative term. (Some drug cures your disease, > but makes you nauseous.) If the effect is intended by the programmer, > and clear in the code, perhaps we should call it an "effect", without > the "side". You're right. I guess "side effect" as I was using it is really a contraction of "unintended side effect" which is a bad thing, but as you point out, not all side effects are bad or unintended. And since the language doesn't prevent ALL side effects for functions, eliminating the "out" parameters adds limitations that really don't add much counterbalancing safety. Steve