Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#18 Add Overloaded functions

open
nobody
5
2001-06-25
2001-06-25
Charles Hixson
No

If the intention is to, at some point in the future,
merge Fine back into Eiffel, then perhaps this request
should be ignored. Dr. Meyers quite dislikes
overloaded functions, however:

The absence of this category is particularly noticable
when adding characters into strings, etc. Strings
being one of the special types (i.e., quotes delimit
string literals) it is quite hard to replace them.
Descendant classes won't do, because one would want to
do things like:
"As I was " + 'a' + " walking"

I will grant Dr. Meyers arguments that syntax is not
sufficient to disambiguate, but I don't feel that the
agrument suffices. The lack of overloaded functions
causes Eiffel to be filled with routines with names like:
extend_with_string, extend_with_character,
extend_with_int, ...
These are all doing the same thing, just with a
different kind of argument. Yes, I will acknowledge
that is can be misused, but I don't find that a
compelling argument either. All languages have
features that can be misused. The ability to turn off
DBC checking can be misused. Further, I would suggest
that the model to use in creating an overloaded
function is Ada/Lisp rather than Java (I don't know how
C++ does it). In particular, the value being returned
should be one of the aguments used in determining the
particular version of the function.

Discussion