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 X-Google-Thread: 103376,9f3d09bde7b33b5d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-04-12 03:29:59 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!dialin-145-254-037-237.arcor-ip.NET!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Pass by reference Date: Mon, 12 Apr 2004 12:29:27 +0200 Organization: At home Message-ID: References: <19b0e504.0404080652.4eab9f80@posting.google.com> <19b0e504.0404090438.7e800536@posting.google.com> <87n05i4rdp.fsf@deneb.enyo.de> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: dialin-145-254-037-237.arcor-ip.net (145.254.37.237) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.uni-berlin.de 1081765797 545356 I 145.254.37.237 ([77047]) User-Agent: KNode/0.7.2 Xref: archiver1.google.com comp.lang.ada:6996 Date: 2004-04-12T12:29:27+02:00 List-Id: Florian Weimer wrote: > "Dmitry A. Kazakov" writes: > >> Because that could be a handle requiring Initialize/Adjust/Finalize. To >> be honest, forcing tagged types to be by-reference was probably a >> mistake. > > It's hard to envision another efficient way of implementing > dispatching calls. Why? Dispatching does not depend on the way an object is passed. For example, let you have a by-copy T and Foo (Object : in out T); is a primitive operaton: X : T'Class; Foo (X); -- Selects Foo according the type tag in X -- Copies the T part of X (calls Adjust) -- Calls the selected Foo with the copy -- Finalizes the T part of X (calls Finalize) -- Copies possibly modified T back into X (calls Adjust) -- Finalizes the copy (calls Finalize) When T is in a register it might be more efficient than by-reference. But let the compiler decide it knows better. -- Regards, Dmitry A. Kazakov www.dmitry-kazakov.de