comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Eachus <rieachus@comcast.net>
Subject: Re: anonymous records as tuples
Date: Mon, 12 Mar 2018 12:17:05 -0700 (PDT)
Date: 2018-03-12T12:17:05-07:00	[thread overview]
Message-ID: <2153155f-2778-421f-97cb-4d229fb9355b@googlegroups.com> (raw)
In-Reply-To: <4cf2a76e-626d-4ead-ae8a-dccdef41b283@googlegroups.com>

On Monday, March 12, 2018 at 1:32:46 PM UTC-4, Stephen Leake wrote:
> I recently had to change a function that returned a single integer into a procedure that returns two...

What is wrong with something like:

-- in Tree:

type Return_Values is record
   Real : Integer; 
   Virtual : Integer;
end record;

function Count_Terminals (Index...) return Return_Values;
...

declare 
  Returned: constant Tree.Return_Values := Tree.Count_Terminals(Index);
  Real: Integer renames Returned.Real;
  Virtual: Integer renames Returned.Virtual;
begin 
  if Virtual = 0 then 
     Next_Shared_Token := Next_Shared_Token - Real; 
  end if;
end;

Declaring Returned as a constant is optional.  (And declaring Real as an Integer really rubs me wrong.  But this is a example...) 


  parent reply	other threads:[~2018-03-12 19:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-12 17:32 anonymous records as tuples Stephen Leake
2018-03-12 18:01 ` Dmitry A. Kazakov
2018-03-12 19:17 ` Robert Eachus [this message]
2018-03-12 19:34   ` Stephen Leake
2018-03-12 23:59     ` Randy Brukardt
2018-03-13  2:51       ` Dan'l Miller
2018-03-13  8:28         ` Dmitry A. Kazakov
2018-03-12 21:09 ` Jeffrey R. Carter
replies disabled

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