comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Dowie <martin@re.mo.ve.thedowies.com>
Subject: Re: Ada2012 : Expression functions and extended return statements
Date: Fri, 06 Jan 2012 11:04:33 -0600
Date: 2012-01-06T11:04:33-06:00	[thread overview]
Message-ID: <969888375347561992.217330martin-re.mo.ve.thedowies.com@news.btinternet.com> (raw)
In-Reply-To: wcchb08bx8v.fsf@shell01.TheWorld.com

Robert A Duff <bobduff@shell01.TheWorld.com> wrote:
> Martin Dowie <martin@re.mo.ve.thedowies.com> writes:
> 
>> 2012 RM 3.1 6/3 says it is a declaration (but I should have written
>> 'Result' not 'Return').
> 
> Right, and it declares an object.
> 
>> A bit like Pascal(?), didn't use the function's name at the point of
>> return?...so for function 'Foo' you wrote something like,
>> 
>> Foo := 100;
>> 
>> ?
> 
> Yes, that's the Pascal method.  The problem with it is that
> if you say something like "Foo := Foo + 1;" it does something
> very wrong, especially if Foo has no parameters.
> 
> But the general principle that the result should have a
> name is a good one.
> 
> - Bob

Hmmm, I think the function name is the best clue...and thats all you have
with an expression function now. Also, I tend to only use a variable called
 'Result' these days, which works for both ordinary and extended return
statements but does say what the result represents - so thats kind of a
special case, all other variables are named to give, at least, a clue as to
what the value represents!

-- Martin
-- 
-- Sent from my iPad



  reply	other threads:[~2012-01-06 17:04 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-06  8:45 Ada2012 : Expression functions and extended return statements Martin
2012-01-06  9:45 ` stefan-lucks
2012-01-06 10:02   ` Martin
2012-01-06 11:23     ` Peter C. Chapin
2012-01-06 11:37       ` Martin
2012-01-06 13:13         ` Dmitry A. Kazakov
2012-01-06 14:45           ` Martin Dowie
2012-01-06 15:07             ` Martin
2012-01-06 16:40             ` Robert A Duff
2012-01-06 17:04               ` Martin Dowie [this message]
2012-01-19  7:47               ` David Thompson
2012-01-06 17:20             ` Dmitry A. Kazakov
2012-01-07  1:47               ` Randy Brukardt
2012-01-07  9:21                 ` Dmitry A. Kazakov
2012-01-06 16:45           ` Adam Beneschan
2012-01-06 16:36     ` Adam Beneschan
2012-01-07 14:54     ` stefan-lucks
2012-01-07 15:11       ` Dmitry A. Kazakov
2012-01-08  9:41         ` stefan-lucks
2012-01-09  6:16         ` Randy Brukardt
2012-01-06 15:11   ` J-P. Rosen
2012-01-06 15:26     ` Martin
2012-01-07  1:50       ` Randy Brukardt
2012-01-07 10:12         ` Martin
2012-01-07 12:22           ` Simon Wright
2012-01-07 17:10             ` Martin
2012-01-09  6:21           ` Randy Brukardt
2012-01-09  7:57             ` Martin Dowie
2012-01-31 23:34             ` Yannick Duchêne (Hibou57)
2012-01-06 16:33 ` Adam Beneschan
2012-01-06 16:38   ` Adam Beneschan
2012-01-06 22:12     ` Robert A Duff
2012-01-31 23:20 ` Yannick Duchêne (Hibou57)
replies disabled

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