user-defined operators

Vlad Dumitrescu <>
Fri Mar 26 10:12:12 CET 2004


Just my 2 cents.

> Would be nice to just say this in Erlang:
>
> 0 + over [1, 2, 3, 4].

In this case, I'm not sure that the intent is so clear. I can live with binary
operators, but when there are more arguments, I feel it begins to lose elegance.

For example, the above could also mean "add 0 to the result of the unary
operator 'over' applied to the list".

Also, each argument to 'over' could be an arbitrary expression: without
parantheses and commas, I'd find this harder to read than a call to lists:foldl.

This can create subtle bugs, and in the end people might end using parantheses
or temporary results to make sure they get what they intend. Then I think that
most of the usefulness of these operators vanishes.

I'd rather see the record mess fixed. Preferably with lots of syntactic sugar!
;-)

/Vlad



More information about the erlang-questions mailing list