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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!news.glorb.com!news.buerger.net!news.teledata-fn.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Dispatch on the result still does not work? Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <4a58dfcf$0$30232$9b4e6d93@newsspool1.arcor-online.net> <1rfyxeircfmy1.19a1j3vqyttbo$.dlg@40tude.net> <74j6m.69502$rO.69160@newsfe13.ams2> Date: Sun, 12 Jul 2009 13:30:35 +0200 Message-ID: NNTP-Posting-Date: 12 Jul 2009 13:30:36 CEST NNTP-Posting-Host: 6b206300.newsspool4.arcor-online.net X-Trace: DXC=i9ZHil=XI40U`5g[@c]@J14IUKe]@goR\j\U?OQCg7m]TN\< X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:7012 Date: 2009-07-12T13:30:36+02:00 List-Id: On Sun, 12 Jul 2009 11:40:27 +0100, Chris Moore wrote: > Dmitry A. Kazakov wrote: >> On Sat, 11 Jul 2009 20:54:05 +0200, Georg Bauhaus wrote: >> >>> Dmitry A. Kazakov wrote: >> >>>> Considering this one: >>>> I would expect it rather dispatching on the tag of X, i.e. selecting Value, >>>> which returns S. >>> Another one, I don't like to call this a solution, >>> and the running program differs per compiler >>> used. But both compilers compile the units without errors: >> [...] >> >> I am not sure that it indeed should be resolved. The question is whether >> there exist or should exist cases where one could indeed dispatch on the >> result's type. The construct with assignment was admittedly artificial, it >> was first that came to mind. >> > > But the results type is T'Class. It is not S. Exactly. To be of T'Class is a prerequisite for dispatch. > The original object to > which X refers is of type S. Therefore it could dispatch using S'Tag. > But this is destroyed prior to the > assignment of the value returned by Value. This is an implementation detail. > This can be either S or T. No, if you drag this detail on the surface, then it is strictly neither, because the object has been destroyed, and there is nothing in there. In this case writing anything into the object is a type error. To put it short assignment /= initialization. Assignment is indivisible without breaking the type system. Further depending on how assignment is annotated, considering it a procedure or as finalization + initialization by a function, etc, one can come different conclusions whether it should dispatch or not. For example it can be annotated as procedure (Left, Right : T); -- doubly-dispatching, primitive or procedure (Left : T'Class; Right : T); -- primitive or procedure (Left : T'Class; Right : T'Class); -- class-wide etc. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de