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: fac41,953e1a6689d791f6 X-Google-Attributes: gidfac41,public X-Google-Thread: 103376,953e1a6689d791f6 X-Google-Attributes: gid103376,public From: jhd@herold.franken.de (Joachim Durchholz) Subject: Re: Eiffel and Java + Ada dispatching Date: 1996/11/05 Message-ID: <6KJFAjVF3RB@herold.franken.de>#1/1 X-Deja-AN: 194916642 references: newsgroups: comp.lang.eiffel,comp.lang.ada Date: 1996-11-05T00:00:00+00:00 List-Id: nebbe@iam.unibe.ch wrote 05.11.96: > By the way, consider what Eiffel does. It determines which routine is to be > called based on the name of the routine and the type of one of the > parameters. The only difference with Ada is that Ada uses all the > parameters. I don't think so. Overloading in Ada determines which routine to call _at_ _compile_ _time_. This is very different from Eiffel, which uses the type of one of the parameters to determine which routine to call, _at_ _run_ _time_ (this is called dynamic binding). > There is no semantic difference between determining statically > or dynamically which method is invoked. When Eiffel compilers optimize away > dispatching all they are really doing is static overload resolution. In a sense, you are right. In the absence of polymorphism, dynamic binding degenerates to overloading. (No downplay on overloading intended - I found it quite useful, though it also makes a great pistol if you don't control the semantics very carefully. Dynamic binding is an even better pistol, but luckily the programming-by-contract rules provide an effective safety catch.) However, the central difference is that dynamic binding is always there in Eiffel. You don't have to rewrite Eiffel code to make overloading work, you just don't use polymorphism. You'd have to rewrite Ada code to go from overloading to dynamic binding. The situation is a bit similar to multiplication optimization. Compilers can optimize multiplications with a power of two by issuing left-shift instructions instead of multiplications. But programming languages don't require the programmer to write all multiplications in terms of left-shift operators (even C compilers don't enforce this ;) ), and programmers usually don't think about the difference. Overloading on the first routine parameter is a similar case for an Eiffel programmer; there is no reason why he should consider this special case as anything peculiar. Regards, -Joachim -- Looking for a new job. Resume available on request. WWW version of resume available under http://www.franken.de/users/herold/jhd/resume/index.html