From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,CP1252 Path: g2news2.google.com!postnews.google.com!y17g2000yqn.googlegroups.com!not-for-mail From: =?ISO-8859-1?Q?Hibou57_=28Yannick_Duch=EAne=29?= Newsgroups: comp.lang.ada Subject: Re: Dispatch on the result still does not work? Date: Sat, 11 Jul 2009 06:36:48 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <3a2a94a3-91df-411e-b078-498cc7850554@18g2000yqa.googlegroups.com> NNTP-Posting-Host: 77.198.58.77 Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1247319408 3491 127.0.0.1 (11 Jul 2009 13:36:48 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 11 Jul 2009 13:36:48 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: y17g2000yqn.googlegroups.com; posting-host=77.198.58.77; posting-account=vrfdLAoAAAAauX_3XwyXEwXCWN3A1l8D User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; fr),gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:6981 Date: 2009-07-11T06:36:48-07:00 List-Id: On 11 juil, 14:20, "Dmitry A. Kazakov" wrote: > Conceptually there is no any difference between parameters and results of= a > subprogram IMHO, there is a difference. A result is something created, not something assigned to. It is not like an out formal parameter, which is intended to be use for an assignment. Until the function creates the return value, the return value does not exist. The result of the function may be may or may be not later assigned to a variable, this matter it out of the function's responsabilities. Here is how it works with an out parameter: + an instance of a variable exists + a procedure is invoked giving it the instance of this variable as a formal out parameter + the procedure assign something to an instance which already exists Here is how it works with a function (conceptually): + the function is invoked + it creates a result + the returned created result is handled in various way by the calle This is onceptually not the same. Then if you have =93 A :=3D F (B); =94, for optimization purpose, the compiler may implement it passing a reference to A to the function F, and F may directly assign the result to the A reference, but this is not the concept, this is a particular implementation. Now, what if the function is invoked for a formal parameter which is, let say =93 Parameter : T'Class =94 ? You view of the =93 concept =94 is no more valid in this context (no more tagged value any more, unless you expect to rely on a default for this formal parameter), and in any way, the compiler will no more be able to apply the later optimization exemple. Conceptually, returning a result from a function, is not an assignment, this is.... just returning a result from a function. If it later turns into an assignment, this is a matter of the usage of the function, not a matter of the work of the function. As a proof, this happens only later, after the function was invoked, and more than that, the result may not be assigned to any variable. Have a nice time Dmitry