Richard A. O'Keefe
Fri Apr 2 01:24:23 CEST 2004
> f/2 in that example has ONE definition.
> It is a CONFUSING function but not an OVERLOADED function.
> Erlang simply doesn't have any mechanism for overloading functions.
Samuel Rivas <> wrote:
f/2 is NOT ONE operation (so it must be several) and f/2 has ONE
It has one definition, and therefore it CANNOT POSSIBLY be more than one
operation. It's a function d--nit!
*Your* definition (p334 of a famous compiler textbook) says
that symbol is overloaded.
No, it doesn't. By that definition, f/2 is NOT overloaded.
1) I don't attack user defined operators on the grounds of "overloading", I
wrote that OPERATORS (in general) overloading is confusing.
But the proposal we are discussing DOES NOT HAVE ANY OPERATOR OVERLOADING.
I don't know how you have infered I said user-defined
operators are bad because of overloading.
You have just written that "OPERATORS (in general) overloading is confusing".
And you don't why why I inferred that you think "user-defined operators are
bad because of overloading"?
> Ah, now I understand your form of argument.
> Every man is a cripple, because if he didn't have his legs, he would
> be a cripple.
> Every system of infix operators is ambiguous, because if it didn't
> have its system of precedence, it would be ambiguous.
I didn't write "infix systems are ambiguous". I wrote "infix notation
I never said that you wrote "infix systems are ambigous". The term I wrote
was "system of infix operators", and it was clearly my paraphrase. Any
application of infix notation *is* a system of infix operators.
- I didn't say user defined operators are worse than functions.
Then what the h**l is the point of opposing them?
- I didn't say user defined operators are bad because of overloading.
But you DID say that they are overloaded and you DID say that overloaded
operators are bad.
- I didn't say built in operators will lose their meaning.
But you DID say that people won't know what they mean any more.
(Not in those exact words.)
- I said user defined operators (in my opinion) are not more readable
You are entitled to hold any opinion you wish; if you want others to
share it, you should provide evidence.
- I say that there is a clear difference between operators and
functions (in Erlang): function names set is infinite and
operators set is not.
Well, gee, if I wasn't already taking that for granted, there would be
no point in suggesting a change, would there?
It is not true operators and functions are the same (at the moment).
They are not identical. But it *is* true that many, if not most,
Erlang operators have the same *properties* as functions. Computations
which can be invoked using existing Erlang operators can also be invoked
using existing Erlang function invocation techniques. The *semantic*
properties of Erlang operators are identical to the *semantic* properties
of built-in functions.
And the things which I claimed to be the same are *user-defined*
operators and user-defined functions, because uses of user-defined
operators simply *are* uses of the corresponding user-defined functions.
I should point out that the widely used statistics environment S
(commercial version: S-Plus from Insightful, open source rival R
from http://www.r-project.org) has also had weakest-precedence
user-defined operators for a long time, with a very similar lexical
structure to current proposal. For example,
x %in% stuff
is a membership test. While %in% uses the syntax for user-defined
operators, it's actually built-in. The S language has run-time types,
just as Erlang has. I'm on the R mailing list. It's very very active
with lots of messages every day. Guess what? People ask about all
SORTS of stuff in R, but one thing I've never seen anyone have any
problems with is %operators%.
The evidence is in: after decades of experience with user-defined
operators in many programming languages, the programming language
community has learned that user-defined operators are *not* a
problem in practice.
More information about the erlang-questions