comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: why only in-parameters in functions
Date: Wed, 29 Sep 2004 16:10:37 -0500
Date: 2004-09-29T16:10:37-05:00	[thread overview]
Message-ID: <gpednZTMzokaucbcRVn-hg@megapath.net> (raw)
In-Reply-To: mailman.131.1096477841.390.comp.lang.ada@ada-france.org

"Alexander E. Kopilovich" <aek@VB1162.spb.edu> 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.







  reply	other threads:[~2004-09-29 21:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-29 15:18 why only in-parameters in functions Rick Santa-Cruz
2004-09-29 15:30 ` stephane richard
2004-09-29 16:55 ` Alexander E. Kopilovich
2004-09-29 21:10   ` Randy Brukardt [this message]
2004-09-29 23:37     ` Björn Persson
2004-09-29 23:46       ` Rick Santa-Cruz
2004-09-29 21:12   ` Florian Weimer
2004-09-30  7:41     ` Dmitry A. Kazakov
2004-09-29 22:42   ` Wojtek Narczynski
2004-09-30  1:55   ` Matthew Heaney
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox