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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4d8b56262a702d36 X-Google-Attributes: gid103376,public From: stt@henning.camb.inmet.com (Tucker Taft) Subject: Re: Dispatching in Ada95 Date: 1996/04/23 Message-ID: #1/1 X-Deja-AN: 150911976 sender: news@inmet.camb.inmet.com (USENET news) x-nntp-posting-host: henning.camb.inmet.com references: <317BCF1F.6542@csehp3.mdc.com> organization: Intermetrics, Inc. newsgroups: comp.lang.ada Date: 1996-04-23T00:00:00+00:00 List-Id: James A. Squire (m193884@CSEHP3.MDC.COM) wrote: : On Fri, 19 Apr 1996 13:34:34, Samuel Tardieu wrote: : > >>>>> "James" == James A Squire writes: : > You're right in saying that it will check a subprogram which is : > directly visible (if you don't give a prefix). But if your parameter : > is of a class-wide type, only a subprogram with the base type of this : > class-wide type needs to be visible. : Correction: Directly visible. No, not directly visible. Direct visibility is required only if you want to write "F(X)"; just plain "visibility" is required if you are willing to write "P.F(X)." In any case, dispatching has nothing to do with visibility. : > Let's take an example. We create a package AAA which defines a class A : > as well as a Create function, and a Get_Info function. : [example snipped] : > Now, our main procedure T. T withes AAA, BBB and Text_IO, and uses all : > of them except BBB. : So, you do compromise and use the use clause, then. That was my whole : question. The use clause *is* essential to dispatching. No, the use clause is irrelevant to dispatching. You can write P.F(X) in a dispatching call. Furthermore, presuming X is of type T'Class, then only the "F" on "T" needs to be visible. The "F" on T1, T2, etc., need not be visible. : Thank you for answering my question. Just another "gotcha" of Ada95 to : note for future reference. I fear these answers have only served to confuse you more ... To reiterate: Dispatching happens at run-time, whenever the controlling operand is class-wide (or otherwise "dynamically tagged") in a call on a primitive subprogram of a tagged type. Dispatching has nothing to do with "use" clauses, and the only thing that has to be visible at compile-time (and not necessarily directly visible) is the primitive operation of the (root) type T, presuming the operand is of (compile-time) type T'Class. : James Squire : MDA Avionics Tools & Processes : ja_squire@csehp3.mdc.com -Tucker Taft stt@inmet.com http://www.inmet.com/~stt/ Intermetrics, Inc. Cambridge, MA USA