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,e528d54e6cc3c10d X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Wed, 29 Sep 2004 16:09:27 -0500 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: Subject: Re: why only in-parameters in functions Date: Wed, 29 Sep 2004 16:10:37 -0500 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Message-ID: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-6cQokwJKl7vUeakeiHmKA0RgDWaq1JdDhLpAKJHi30BSTkwEjKSebSNGNyrcVzO9IzZ2fmzWAL3QLpy!H3YuMqrOzt0EGKF+zRXWsDr4De0hBq/UGMvXYV0pI4Zrqio7AAA5rD8uV2qO2BOK2S3/gsZzWDBZ X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.16 Xref: g2news1.google.com comp.lang.ada:4406 Date: 2004-09-29T16:10:37-05:00 List-Id: "Alexander E. Kopilovich" wrote in message news:mailman.131.1096477841.390.comp.lang.ada@ada-france.org... > Rick Santa-Cruz wrote: > > > I know that it is only allowed to use in-parameters with functions. But I > > can't figure out what is the idea behind this. Why did the Ada-Team only > > allow in-parameter when using functions? > > There were so many discussions on this matter, at various levels, and so manu > arguments pro and contra were expressed that perhaps there should be FAQ for > this topic alone. > > In short, for many years Ada community and ARG (which can be seen as Ada > design team) were (and still are) divided about this matter. The most recent go-round is saved in AI-323. And, yes, opinion is divided enough that it is unlikely to ever change. > In practice, where you really need in-parameters for a function you may either > use a procedure that returns value (if you use GNAT compiler) or you may use > the construct, presented here in c.l.a by Robert I. Eachus (see his message > in comp.lang.ada from 2003-07-15 with Subject: Re: What evil would happen?) The easiest thing to do is to use an access parameter instead. That's somewhat ugly (because it messes up the calls as 'Access is needed), but it works. If you are willing to depend on the definition of the type, a number of things (including the solution suggested previously) work. Another solution (used by Ada.Text_IO, for example) is to insure that the type passed is just a handle to the real object. Controlled types make this solution relatively easy to write. Randy.