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,953e1a6689d791f6 X-Google-Attributes: gid103376,public X-Google-Thread: fac41,953e1a6689d791f6 X-Google-Attributes: gidfac41,public From: Robb Nebbe Subject: Re: Eiffel and Java + Ada dispatching Date: 1996/11/07 Message-ID: <3281A861.1C04@iam.unibe.ch>#1/1 X-Deja-AN: 195044460 references: <327F0D64.619A@iam.unibe.ch> <55p0i3$2u4@tjnews.is.s.u-tokyo.ac.jp> content-type: text/plain; charset=us-ascii organization: Dept. of CS, University of Berne, Switzerland mime-version: 1.0 newsgroups: comp.lang.eiffel,comp.lang.ada x-mailer: Mozilla 2.02 (X11; I; SunOS 5.4 sun4m) Date: 1996-11-07T00:00:00+00:00 List-Id: Jean-Marc Jezequel wrote: > > May be we have a different idea on the meaning of `semantics', but IMHO > there is a difference. In one case it has to be done at compile time (and > e.g. implemented using unique names as you pointed out). In case of > dynamic binding, it has (conceptualy) to be deferred until run-time,and is > basically implemented with a test on the object dynamic type (Ada tag?) to > select the right procedure. I'm using the the standard definition of semantics as it relates to the meaning of a program. Semantics has to do with _what_ and NOT _when_; "when" is closely related to "how" and is an implementation issue. Do Eiffel compilers change the meaning of a program when they optimize away a dispatching call? If not then it is not a semantic issue. I agree completely that there is a difference but for me it is not related to the semantics of the program. >Robb Nebbe wrote: > > When Eiffel compilers optimize away dispatching all they are really > > doing is static overload resolution. > I beg to differ. What they do is to determine statically that the > recipient of a call happends in a *given program* to be of exactly one > type. Since the runtime type test would then return a constant, they just > optimize out the test. In Eiffel there are static and dynamic types where the static type is used to type checking and the dynamic type for dispatching. In Ada there are specific types and class-wide types. The relationship is as folows: A dynamic type in Eiffel always corresponds to a specific-type in Ada. A static type is either a specific type or a class-wide type. In some cases, such as creation, it must be a specifc-type but most of the time it is ambiguous and so in the absence of flow analysis it must be assumed to be a class-wide type, which is the more general of the two cases. Now there are two cases in Eiffel where you can optimize dispatching. The first case is when you know that a static type is a specific type (for exmple after creation). This means that you can optimize away the dispatching because there will never be any need to dispatch in any program. This is decidable locally in Eiffel. The second case is when you can determine through analysis of the entire program that a static type is in fact a specific-type then you can optimize away the dispatching because it is never needed in that specific program. This is only decidable globally in Eiffel. In the first case the compiler can determine at compile time which routine to call based on the name of the routine and the type (which is known to be what Ada calls a specific type) of one of the "parameters" (the term is used very loosely so use your imagination). Can you see the analogy with overloading? I didn't mean to pretend that they are precisely the same (which you would have been a reasonable interpretation of my previous post :-) just that they are similar. Claiming that Eiffel has no overloading, while technically correct, provides virtually no insight into the relationship between Ada and Eiffel. I would prefer that these discussions lead to a better understanding of this relationship at some meaningful level. Robb Nebbe