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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fac41,953e1a6689d791f6 X-Google-Attributes: gidfac41,public X-Google-Thread: 103376,953e1a6689d791f6 X-Google-Attributes: gid103376,public X-Google-Thread: 109fba,953e1a6689d791f6 X-Google-Attributes: gid109fba,public From: "Norman H. Cohen" Subject: Re: Eiffel and Java Date: 1996/11/05 Message-ID: <327FBBEB.7858@watson.ibm.com>#1/1 X-Deja-AN: 194714795 references: content-type: text/plain; charset=us-ascii organization: IBM Thomas J. Watson Research Center mime-version: 1.0 reply-to: ncohen@watson.ibm.com newsgroups: comp.lang.eiffel,comp.lang.ada,comp.lang.c++ x-mailer: Mozilla 3.0 (Win95; I) Date: 1996-11-05T00:00:00+00:00 List-Id: Joachim Durchholz wrote: > Though I'd expect that similar problems exist for dispatching as well as > for overloading. In both cases, it is necessary to decide which of several > similar functions is the right one, overloading at compile time, > dispatching (dynamic binding) at run-time. But this choice is straightforward in the case of dispatching: You dispatch to the version for the type indicated by the tags of the controlling parameters (or the controlling result). If there is more than one controlling parameter and the tags do not match, it is a run-time error, raising an exception. The only potential bit of ambiguity is in deciding whether a "tag indeterminate" call--a call on a function that has a controlling result and no controlling parameters except perhaps other tag indeterminate calls--is dispatching. The rule is that a tag-indeterminate call is not a dispatching call unless it has to be. A tag-indeterminate call has to be a dispatching call if it is a parameter in some surrounding call that has to be dispatching (e.g. because the surrounding call has a classwide controlling parameter). Here is an example: package P is type T is tagged ...; type CWP is access all T'Class; procedure S (X1, X2: in T); function F1 (X: T) return T; function F2 (X: Integer) return T; end P; A : CWP; B : T; (A call on F2 is always tag-indeterminate. A call on F1 is tag-indeterminate if and only if its parameter is tag indeterminate, as in F1(F2(0)) or in the outermost call of F1(F1(F2(0))).) The call S( F1(F2(0)), F2(1) ); is not dispatching. Each call on F2, and the call on F1, return a value of type T. The call on S has two parameters of type T, causing the version of S declared in P to be invoked. The call S( F1(F2(0)), A.all); IS dispatching, because the second parameter to S, A.all, is classwide. That means that the call on F1 must dispatch to the version of F1 for the type indicated by the tag value A'Tag. That, in turn, means that the call on F2 must be dispatch to the version of F2 for that type. The rules in the RM are hard to understand, but the bottom line is that dispatching occurs only in calls where there is data whose tag is not determinable at compile time (looking at a single statement in isolation). > > Well, let's just say that it was appropriate that you posted your > > message on October 31. ;-) > > Is there anything special about Oct 31? It is called "Reformation Day" > here in Germany (has to do with Luther and Protestants), but I'm not sure > you mean that or something else... You had asked whether you were "seeing ghosts". October 31 is Halloween (a variation on "All Hollows' Eve", i.e., the evening before All Saints Day). In the United States (I had thought this was a European tradition too, and I am surprised to learn otherwise) it has become associated with ghosts, goblins, witches, and so forth (as well as with institutionalized extortion by children who threaten to vandalize the property of those who do not offer candy in return for protection). -- Norman H. Cohen mailto:ncohen@watson.ibm.com http://www.research.ibm.com/people/n/ncohen