From: Kaz Kylheku Newsgroups: comp.compilers Subject: Re: Looking for volunteers for XL Date: Thu, 1 Dec 2011 05:44:28 +0000 (UTC) Organization: A noiseless patient Spider Lines: 47 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <11-12-003@comp.compilers> References: <11-11-048@comp.compilers> <11-11-053@comp.compilers> <11-11-054@comp.compilers> <11-11-058@comp.compilers> <11-11-060@comp.compilers> <11-11-067@comp.compilers> <11-11-070@comp.compilers> NNTP-Posting-Host: news.iecc.com X-Trace: leila.iecc.com 1322803811 57186 64.57.183.58 (2 Dec 2011 05:30:11 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Fri, 2 Dec 2011 05:30:11 +0000 (UTC) Keywords: types Posted-Date: 02 Dec 2011 00:30:11 EST X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.franciliens.net!feed.ac-versailles.fr!proxad.net!feeder1-2.proxad.net!74.125.46.80.MISMATCH!postnews.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.iecc.com!nerds-end Xref: x330-a1.tempe.blueboxinc.net comp.compilers:375 On 2011-11-30, ardjussi wrote: > On 29 marras, 00:12, Christophe de Dinechin > wrote: >> >> > The other kind of extensibility I know about is operator overloading, >> > where the problems are well-known; the expression A+B could >> > conceivably mean anything, instead of being restricted to a small set >> > of predefined types. >> >> This argument was made a long time ago by Bertrand Meyer in a very >> articulate article, see >> http://se.ethz.ch/~meyer/publications/joop/overloading.pdf. >> >> While the article is very well written, I totally disagree with Meyer >> on this (even though I respect him a lot as a language designer). Why? >> Because I can't even think of using a programming language where I >> need to write "1 + 2" for integer addition, and something different >> like "1.3 +. 4.2" for floating-point addition. > > This is not the case with Eiffel. The addition operator for both > integer and floating is "+". This is not a case of operator > overloading in pure object oriented setting of Eiffel, since the > operator appears in two different classes: integer and floating. An > example of overloading would be "+" appearing twice with different > signatures in the integer class. Overloading is any situation in which a symbol has more than one meaning, resolved by context, such as the class of some argument. It is "loaded up" with two or more meanings, hence "overloaded". "Appearing in the class" is a very language-specific notion. In fact when we invoke some operation "on" an object: x.foo(y), obj is an argument to the function foo: this is just a syntactic sugar for foo(x, y). Except that in many Blub-type languages, x is given a special treatment: x's dynamic type gets taken into account to determine the call, but only the static type of y. Just because the dynamic type of x is used, and the static type of y does not mean that foo is overloaded only with respect to argument y. Let us not confuse "overloading" as it is used Eiffel or C++ with, well, computer science. Both the static and dynamic types supply context to resolve the meaning of the call foo.