From: Brian Drummond <brian@shapes.demon.co.uk>
Subject: Re: anonymous aggregates?
Date: Fri, 31 Aug 2012 11:06:24 +0000 (UTC)
Date: 2012-08-31T11:06:24+00:00 [thread overview]
Message-ID: <k1q5rg$ch2$1@dont-email.me> (raw)
In-Reply-To: 85mx1bwec4.fsf@stephe-leake.org
On Fri, 31 Aug 2012 06:22:35 -0400, Stephen Leake wrote:
> Occasionally I have the following pattern:
>
> declare
> A : Integer;
> B : Float;
>
> procedure Foo (A : out Integer; B : out Float);
...
> In general, I prefer to initialize variables in the declaration, and
> declare them constant if possible. But I can't do that here.
>
> One option in current Ada is to declare a record type;
>
> declare
> type Foo_Return_Type is record
> A : Integer;
> B : Float;
> end record;
...
> But that seems like overkill, especially since the code in "..." must be
> edited; all references to A must be replaced by A_B.A.
All references, or just one?
(in the declarations section, just after the initialisation of A_B)
A : constant Integer renames A_B.A;
- Brian
next prev parent reply other threads:[~2012-09-07 1:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-31 10:22 anonymous aggregates? Stephen Leake
2012-08-31 11:06 ` Brian Drummond [this message]
2012-08-31 12:02 ` Dmitry A. Kazakov
2012-08-31 15:15 ` Adam Beneschan
2012-08-31 22:37 ` Randy Brukardt
2012-08-31 22:57 ` Shark8
2012-09-01 9:57 ` Georg Bauhaus
2012-09-02 11:25 ` Stephen Leake
2012-09-02 12:34 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox