From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Ada 2012: In-out parameters for functions
Date: Thu, 2 May 2013 08:41:41 +0200
Date: 2013-05-02T08:41:41+02:00 [thread overview]
Message-ID: <tdnksjzm89la$.1jrqt9m7ta4ha.dlg@40tude.net> (raw)
In-Reply-To: op.wwe8fy11ule2fv@cardamome
On Wed, 01 May 2013 21:58:36 +0200, Yannick Duchêne (Hibou57) wrote:
> Le Wed, 01 May 2013 21:37:43 +0200, Dmitry A. Kazakov
> <mailbox@dmitry-kazakov.de> a écrit:
>
>> On Wed, 01 May 2013 21:04:03 +0200, Yannick Duchêne (Hibou57) wrote:
>>
>>> In/out (both way) parameters may be another story, and may more suggest
>>> this is a procedure and not a function,
>>
>> function Read (Stream : in out Root_Stream_Type) return String;
>
> :D
>
> This is more a procedure than a function (it either won't return the same
> the next time invoked with the same argument or either the argument can
> never be considered to be the same as it use to be any‑more),
Surely it will. Same argument means same value and the value of a stream is
its state. If the stream is in the same state the function will return same
result.
> and a
> function construct is used only because it is preferable to return an
> unconstrained type
Not only. Functions are used when there is a dedicated result/effect which
is used as an input for another routine or language construct.
> That's a good example of how a construct may not always match the intended
> semantic;
The semantics [in the context of program design] of a function and
procedure are exactly same, it is called "subroutine."
> I feel `function` and `procedure` in Ada means something at the
> implementation level more than at the intention level, even if many times
> both matches as gloves and hands.
Ada 83 confused function as a syntactic form of a subroutine with pure
function. Allowing in/out arguments resolves that only partially. Pure
functions (of different purity levels) are still needed.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2013-05-02 6:41 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-01 16:28 Ada 2012: In-out parameters for functions dptrash
2013-05-01 17:27 ` Shark8
2013-05-01 19:04 ` Yannick Duchêne (Hibou57)
2013-05-01 19:37 ` Dmitry A. Kazakov
2013-05-01 19:58 ` Yannick Duchêne (Hibou57)
2013-05-02 6:41 ` Dmitry A. Kazakov [this message]
2013-05-02 7:11 ` Yannick Duchêne (Hibou57)
2013-05-01 23:37 ` Peter C. Chapin
2013-05-03 10:48 ` anon
2013-05-03 11:04 ` Simon Clubley
2013-05-03 11:32 ` Simon Wright
2013-05-03 11:42 ` Yannick Duchêne (Hibou57)
2013-05-03 11:54 ` Yannick Duchêne (Hibou57)
2013-05-03 23:29 ` Randy Brukardt
2013-05-04 1:02 ` Adam Beneschan
2013-05-05 5:16 ` Randy Brukardt
2013-05-05 10:24 ` Niklas Holsti
2013-05-05 11:11 ` Yannick Duchêne (Hibou57)
2013-05-05 12:52 ` Bill Findlay
2013-05-05 15:09 ` Niklas Holsti
2013-05-05 19:23 ` Yannick Duchêne (Hibou57)
2013-05-05 20:37 ` Niklas Holsti
2013-05-07 0:30 ` Randy Brukardt
2013-05-07 2:36 ` Yannick Duchêne (Hibou57)
2013-05-05 19:45 ` Yannick Duchêne (Hibou57)
2013-05-06 15:40 ` Adam Beneschan
2013-05-06 16:17 ` Bill Findlay
2013-05-06 16:47 ` Adam Beneschan
2013-05-06 18:43 ` Bill Findlay
2013-05-07 0:07 ` Dennis Lee Bieber
2013-05-07 2:34 ` Yannick Duchêne (Hibou57)
2013-05-07 0:26 ` Randy Brukardt
2013-05-06 15:26 ` Adam Beneschan
2013-05-07 0:36 ` Randy Brukardt
2013-05-07 3:59 ` Yannick Duchêne (Hibou57)
2013-05-07 4:13 ` Yannick Duchêne (Hibou57)
2013-05-07 11:52 ` Yannick Duchêne (Hibou57)
2013-05-03 11:45 ` AdaMagica
2013-05-03 23:54 ` Randy Brukardt
2013-05-04 6:58 ` J-P. Rosen
2013-05-04 7:21 ` Dmitry A. Kazakov
2013-05-04 17:58 ` J-P. Rosen
2013-05-04 7:40 ` Yannick Duchêne (Hibou57)
2013-05-04 8:05 ` Simon Wright
2013-05-04 17:55 ` J-P. Rosen
2013-05-04 0:40 ` Keith Thompson
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox