comp.lang.ada
 help / color / mirror / Atom feed
From: Victor Porton <porton@narod.ru>
Subject: Re: If a routine should return two results, how should it be done?
Date: Sat, 26 Jul 2014 23:44:33 +0300
Date: 2014-07-26T23:44:33+03:00	[thread overview]
Message-ID: <lr13vd$ri5$2@speranza.aioe.org> (raw)
In-Reply-To: lr13r2$ri5$1@speranza.aioe.org

Victor Porton wrote:

> Victor Porton wrote:
> 
>> If a routine should return two results, how should it be done?
>> 
>> 1. procedure with two out arguments;
>> 
>> 2. function with one out argument;
>> 
>> 3. create specific record type for the result type of the function?
>> 
>> What are advantages and disadvantages of each variant?
> 
> After reading around in Internet, I am declined to the variant 3.
> 
> With variant 3 I need to create only one variable (or rather a constant),
> thus making the program a little shorter.
> 
> Hm, well, maybe implement BOTH 1 and 3?

This (variant 3) also reduces the likehood to confuse two variables of the 
same type.

And also with 3 I may need a constant instead of two variables, using 
constants is nice.

-- 
Victor Porton - http://portonvictor.org

  reply	other threads:[~2014-07-26 20:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-26 18:00 If a routine should return two results, how should it be done? Victor Porton
2014-07-26 18:53 ` Niklas Holsti
2014-07-26 18:57   ` Victor Porton
2014-07-26 19:21     ` Peter Chapin
2014-07-26 19:37       ` Dan'l Miller
2014-07-26 20:10     ` Shark8
2014-07-26 20:42 ` Victor Porton
2014-07-26 20:44   ` Victor Porton [this message]
2014-07-27 11:59 ` anon
replies disabled

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