comp.lang.ada
 help / color / mirror / Atom feed
From: donh@syd.csa.com.au (Don Harrison)
Subject: To overload or not to overload (was Eiffel and Java + Ada dispatching)
Date: 1996/11/06
Date: 1996-11-06T00:00:00+00:00	[thread overview]
Message-ID: <E0Fq8E.LJJ@syd.csa.com.au> (raw)
In-Reply-To: 327F0D64.619A@iam.unibe.ch


Robb Nebbe writes:

:you need to keep in mind that a language is a tool. People become very frusterated
:with tools that interfere with doing work rather than help, unless they can
:rationalize this in terms of saftey or something. Overloading is the language
:getting out of your way so you can concentrate on what is really important.

This may be true in some cases (eg. for Ada) but there is also a downside. 
(See below).

:Think of it as separation of concerns. When you are writing software it is better
:to concentrate on finding meaningful names rather than "Did I already use that
:somewhere?" I have better things to do than manually resolving overloading.

IMO, operations that do the same thing should have the same name and there
should be only one operation per class that does a particular thing. In 
particular, overriding operations should retain the same name (unless a more
specific name is in order due to specialisation). Further, if two operations 
do similar but different things, they should still be given distinct names. 
My justification for this is that it is easier to understand an operation call 
if you can disregard the type of the non-dispatching parameters. Having to
consider their type just makes understanding more difficult.

Excluding overloading is reasonable for Eiffel but may not be for Ada. The 
reason I say this is that Eiffel is covariant and Ada avariant. As Jon pointed 
out, you may wish to use overloading to indicate that a 'covariant' operation 
does the same thing. Because in Eiffel such operations are truly covariant,
they are semantically related to their parent operations (by inheriatance)
and share the same name. So, Eiffel does not need overloading (for this 
purpose, at least).

Another related problem I see with overloading is that it is too liberal in
that it permits you to use a common name for completely unrelated operations.
Overloading can encourage you to be lazy by using an existing name instead 
of thinking of a more appropriate one. IMO, this freedom to name poorly
promotes obfuscation. 

:You are correct in saying that there is no semantic difference between
:unique names and overloading. 

Okay.

:However, just because there is no semantic
:difference don't suppose that it doesn't play a critical role in how the language
:is defined. 

Not sure what you mean here.

: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. 

Only in a special case, though.

: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. 

Yes, but this complexity is *hidden* form the user (as it ought to be).


Yes, a language is just a tool but a good tool will give you help where you
need it and this may mean curtailing your freedom where it will do you good.
An absence of overloading is a help rather than a hinderance, IMO.


Don.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Don Harrison             donh@syd.csa.com.au






  parent reply	other threads:[~1996-11-06  0:00 UTC|newest]

Thread overview: 162+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-10-27  0:00 Eiffel and Java Vincent WEBER
1996-10-27  0:00 ` Jean-Michel P. Decombe
1996-10-28  0:00   ` Robert Dewar
1996-10-31  0:00     ` Doug Marker
1996-10-28  0:00   ` David Hanley
1996-10-28  0:00     ` Matt Kennel
1996-10-28  0:00   ` Alexandre Oliva
1996-10-29  0:00   ` Chris Trimble
1996-10-31  0:00     ` Doug Marker
1996-10-31  0:00   ` David Bennett
1996-10-28  0:00 ` Larry Kilgallen
1996-10-30  0:00   ` Ronald Cole
1996-10-28  0:00 ` Matthew Heaney
1996-10-29  0:00   ` Vincent WEBER
1996-10-31  0:00     ` James McKim
1996-11-01  0:00       ` Matthew Heaney
1996-11-04  0:00         ` James McKim
1996-10-30  0:00   ` Jon S Anthony
1996-11-01  0:00     ` Eiffel and Java + Ada dispatching Jean-Marc Jezequel
1996-10-30  0:00   ` Eiffel and Java Don Harrison
1996-10-31  0:00     ` James McKim
1996-11-04  0:00       ` Don Harrison
1996-11-23  0:00       ` Van Snyder
1996-10-31  0:00   ` Joachim Durchholz
1996-11-01  0:00   ` Norman H. Cohen
1996-11-02  0:00   ` Eiffel and Java + Ada dispatching Jon S Anthony
1996-11-02  0:00   ` Eiffel and Java Jon S Anthony
1996-11-03  0:00   ` Joachim Durchholz
1996-11-05  0:00   ` Norman H. Cohen
1996-10-29  0:00 ` Don Harrison
1996-10-29  0:00   ` Fergus Henderson
1996-10-30  0:00     ` Don Harrison
1996-10-30  0:00       ` Fergus Henderson
1996-10-31  0:00     ` David L. Shang
1996-11-01  0:00       ` Matt Kennel
1996-11-04  0:00         ` David L. Shang
1996-11-05  0:00           ` Matt Kennel
1996-11-06  0:00             ` David L. Shang
1996-11-04  0:00       ` Robert I. Eachus
1996-11-01  0:00     ` Jon S Anthony
1996-11-02  0:00       ` Fergus Henderson
1996-11-04  0:00       ` David L. Shang
1996-11-05  0:00         ` Jon S Anthony
1996-11-02  0:00     ` Darko BUDOR
1996-11-02  0:00       ` Fergus Henderson
1996-11-03  0:00         ` Matt Kennel
1996-11-03  0:00         ` Darko BUDOR
1996-11-03  0:00     ` Matthias Ernst
1996-11-03  0:00     ` Jon S Anthony
1996-11-05  0:00     ` Jon S Anthony
1996-11-10  0:00     ` Marcos F. F. de Macedo
1996-11-11  0:00       ` David L. Shang
1996-11-12  0:00         ` Fergus Henderson
1996-11-12  0:00           ` David L. Shang
1996-11-12  0:00             ` David L. Shang
1996-11-16  0:00             ` Fergus Henderson
1996-11-18  0:00               ` David L. Shang
1996-11-18  0:00             ` Kai Quale
1996-11-18  0:00               ` David L. Shang
1996-11-25  0:00                 ` Kai Quale
1996-11-15  0:00         ` Paul Johnson
1996-11-12  0:00       ` Alexander Asteroth
1996-11-11  0:00         ` Marcos F. F. de Macedo
1996-11-12  0:00         ` Matt Kennel
1996-11-12  0:00         ` Benedict A. Gomes
1996-10-29  0:00   ` Eiffel and Java + Ada dispatching Vincent WEBER
1996-10-30  0:00     ` Jean-Marc Jezequel
1996-11-01  0:00       ` Don Harrison
1996-11-01  0:00       ` Joachim Durchholz
1996-10-30  0:00     ` Don Harrison
1996-10-30  0:00       ` Jon S Anthony
1996-10-30  0:00   ` Jon S Anthony
1996-11-04  0:00     ` Don Harrison
1996-11-04  0:00       ` C to Ada Ali Mirhosseini
1996-11-04  0:00         ` Matthew Daniel
1996-11-04  0:00         ` Robert Dewar
1996-11-05  0:00       ` Eiffel and Java + Ada dispatching Jon S Anthony
1996-11-05  0:00         ` Don Harrison
1996-11-06  0:00           ` Jon S Anthony
1996-10-30  0:00   ` Eiffel and Java David Petrie Stoutamire
1996-10-30  0:00   ` Eiffel and Java + Ada dispatching Robert I. Eachus
1996-10-31  0:00   ` Joachim Durchholz
1996-10-31  0:00   ` Jon S Anthony
     [not found]     ` <E06F2B.Az7@syd.csa.com.au>
1996-11-01  0:00       ` Jon S Anthony
1996-11-04  0:00         ` Don Harrison
1996-11-05  0:00           ` Jon S Anthony
1996-11-02  0:00       ` Robert Dewar
1996-11-04  0:00         ` Norman H. Cohen
1996-11-05  0:00         ` Don Harrison
1996-11-05  0:00           ` Joachim Durchholz
1996-11-05  0:00           ` Robb Nebbe
1996-11-06  0:00             ` Jean-Marc Jezequel
1996-11-07  0:00               ` Robb Nebbe
1996-11-06  0:00             ` Don Harrison [this message]
1996-11-06  0:00               ` To overload or not to overload (was Eiffel and Java + Ada dispatching) Robb Nebbe
1996-11-07  0:00                 ` Norman H. Cohen
1996-11-07  0:00                 ` Don Harrison
1996-11-07  0:00                   ` Jon S Anthony
1996-11-11  0:00                     ` Don Harrison
1996-11-07  0:00                   ` Juergen Schlegelmilch
1996-11-08  0:00                     ` Don Harrison
1996-11-08  0:00                       ` Don Harrison
1996-11-14  0:00                         ` Jon S Anthony
1996-11-14  0:00                     ` Jon S Anthony
1996-11-07  0:00                   ` Jon S Anthony
1996-11-08  0:00                   ` bill.williams
1996-11-11  0:00                     ` Don Harrison
1996-11-08  0:00             ` Eiffel and Java + Ada dispatching Robert I. Eachus
1996-11-06  0:00           ` Robert I. Eachus
1996-11-08  0:00             ` Don Harrison
1996-11-08  0:00               ` Jon S Anthony
1996-11-08  0:00               ` Robert A Duff
1996-11-12  0:00                 ` Don Harrison
1996-11-12  0:00                   ` Robert A Duff
1996-11-13  0:00                     ` Don Harrison
1996-11-13  0:00                       ` Jon S Anthony
1996-11-15  0:00                         ` Don Harrison
1996-11-19  0:00                           ` Jon S Anthony
1996-11-20  0:00                             ` Don Harrison
1996-11-13  0:00                       ` Robert A Duff
1996-11-14  0:00                         ` Don Harrison
1996-11-12  0:00                   ` Joachim Durchholz
1996-11-15  0:00                     ` Richard Riehle
1996-11-16  0:00                     ` Interfacing contracts (Was: Eiffel and Java + Ada dispatching) Geert Bosch
1996-11-17  0:00                       ` Robert A Duff
1996-11-14  0:00               ` Eiffel and Java + Ada dispatching Robert I. Eachus
1996-11-14  0:00                 ` Robert A Duff
1996-11-15  0:00                 ` Don Harrison
1996-11-15  0:00                   ` Robert I. Eachus
1996-11-19  0:00                     ` Don Harrison
1996-11-18  0:00                       ` Vincent Celier
1996-11-22  0:00                         ` Don Harrison
1996-11-19  0:00                 ` Jon S Anthony
1996-11-15  0:00               ` portmanteau (was Re: Eiffel and Java + Ada dispatching) Robert I. Eachus
1996-11-07  0:00           ` Eiffel and Java + Ada dispatching Robb Nebbe
1996-11-07  0:00           ` Jon S Anthony
1996-11-12  0:00           ` Jon S Anthony
1996-11-01  0:00     ` Jean-Marc Jezequel
1996-11-01  0:00   ` Eiffel and Java Matthias Ernst
1996-11-01  0:00     ` Benedict A. Gomes
1996-11-01  0:00     ` William Clodius
1996-11-02  0:00   ` Eiffel and Java + Ada dispatching Jon S Anthony
1996-11-02  0:00   ` Jon S Anthony
1996-11-04  0:00   ` Eiffel and Java Robert I. Eachus
1996-10-30  0:00 ` Jon S Anthony
1996-11-01  0:00   ` Don Harrison
1996-11-01  0:00     ` Jon S Anthony
1996-11-07  0:00       ` Marcos F. F. de Macedo
1996-11-11  0:00         ` Ian Joyner
1996-11-12  0:00         ` Don Harrison
1996-11-13  0:00           ` Norman H. Cohen
1996-11-15  0:00             ` Don Harrison
1996-11-14  0:00           ` Jon S Anthony
1996-11-15  0:00             ` Don Harrison
1996-11-19  0:00               ` Jon S Anthony
1996-11-21  0:00                 ` Don Harrison
1996-11-12  0:00     ` Jon S Anthony
1996-10-31  0:00 ` Joachim Durchholz
1996-11-01  0:00 ` Jon S Anthony
1996-11-02  0:00 ` Jon S Anthony
1996-11-03  0:00 ` Eiffel and Java + Ada dispatching Joachim Durchholz
1996-11-04  0:00 ` Eiffel and Java Richard A. O'Keefe
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox