user-defined operators
Thomas Lindgren
thomasl_erlang@REDACTED
Thu Mar 25 22:19:50 CET 2004
--- "Martin J. Logan" <mlogan@REDACTED> wrote:
> I think that the overloading of operators is a nifty
> idea and I can
> think of a few places where it would make my life
> easier. I must state
> in the face of my previous statement that my take on
> operator
> overloading and defining ones own operators is that
> it should not be
> done. Operators should be defined by a central body
> responsible for the
> language syntax and semantics. In this way a modicum
> of consistency in
> the language is ensured.
However, note that:
- there is a single way to write the new operator:
`op`
- there is a single, fixed precedence
(one should also define the infix-op to be
non-associative)
- there is a simple semantics (function call)
That avoids most of the problems with extensible
syntax, I think; in particular, there is no need to
know what operators have been defined (or how) to read
the program.
An alternate view is that this is special notation for
a restricted apply. Mangling syntax just a little bit
more:
X `Op` Y -> Op(X,Y).
Best,
Thomas
__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html
More information about the erlang-questions
mailing list